我正在尝试在xenserver上使用打包程序来构建“ vdi_vhd”映像,但是我遇到了以下错误,请任何人帮助我,谢谢。
> [root@localhost bin]# packer build /usr/local/test-scripts/main.json
> xenserver-iso output will be in this color.
>
> ==> xenserver-iso: XAPI client session established
> ==> xenserver-iso: Downloading or copying ISO
> xenserver-iso: Downloading or copying: http://www.mirrorservice.org/sites/mirror.centos.org/7.6.1810/isos/x86_64/CentOS-7-x86_64-Minimal-1810.iso
> xenserver-iso: Error downloading: open : no such file or directory
> ==> xenserver-iso: ISO download failed. Build 'xenserver-iso' errored: ISO download failed.
>
> ==> Some builds didn't complete successfully and had errors:
> --> xenserver-iso: ISO download failed.
>
> ==> Builds finished but no artifacts were created.
click here to see the error output
这些是我用来安装打包程序的步骤
mkdir -p /usr/local/packer/
cd /usr/local/packer/
wget https://releases.hashicorp.com/packer/1.4.1/packer_1.4.1_linux_amd64.zip
unzip packer_1.4.1_linux_amd64.zip
vim ~/.bashrc
##added the below
export PATH=/usr/local/packer/:$PATH
##save and exit
sudo ln -s /usr/local/packer/packer /usr/bin/packer
source ~/.bashrc
这些是我用来安装xenserver-iso插件的步骤
RELEASE="go1.12.6.linux-amd64.tar.gz";
cd /tmp && curl -L -O "https://dl.google.com/go/${RELEASE}";
tar -zxvf "${RELEASE}";
mv -v go $HOME/go-1.12.6;
rm -f "/tmp/${RELEASE}";
vim ~/.bashrc
##added the below
export GOROOT=$HOME/go-1.12.6;
export GOPATH=$HOME/go-workspace;
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin;
##save and exit
source ~/.bashrc
mkdir -p $GOPATH/src/github.com/hashicorp/packer;
cd $GOPATH/src/github.com/hashicorp/packer;
go get github.com/mitchellh/gox;
go get github.com/mitchellh/go-vnc;
cd $GOPATH;
PROV="src/github.com/xenserver";
mkdir -p $PROV && cd $PROV;
git clone https://github.com/xenserver/packer-builder-xenserver.git;
cd packer-builder-xenserver;
./build.sh;
[root@localhost bin]# ll
total 34732
-rwxr-xr-x. 1 root root 17813736 Jul 2 12:04 packer-builder-xenserver-iso
-rwxr-xr-x. 1 root root 17747856 Jul 2 12:04 packer-builder-xenserver-xva
[root@localhost bin]# pwd
/root/go-workspace/src/github.com/xenserver/packer-builder-xenserver/bin
[root@localhost bin]#
注意:我已经在Virtual-box本地服务器上安装了打包程序和xenserver插件
> {
> "builders": [
> {
> "iso_checksum": "38d5d51d9d100fd73df031ffd6bd8b1297ce24660dc8c13a3b8b4534a4bd291c",
> "iso_checksum_type": "sha256",
> "iso_url": "{{user `mirror`}}/7.6.1810/isos/x86_64/CentOS-7-x86_64-Minimal-1810.iso",
> "output_directory": "CentOS-7-x86_64-xenserver-minimal",
> "format": "vdi_vhd",
> "remote_host": "192.1XX.XX.XX",
> "remote_password": "XXXXX",
> "remote_username": "root",
> "shutdown_command": "/sbin/halt",
> "ssh_password": "XXXXX",
> "ssh_username": "root",
> "ssh_wait_timeout": "10000s",
> "type": "xenserver-iso",
> "vm_name": "packer-centos-7.6-x86_64"
> }
> ],
> "variables": {
> "mirror": "http://www.mirrorservice.org/sites/mirror.centos.org"
> }
> }
我希望输出如下所示,
==> Builds finished. The artifacts of successful builds are