如何启动由 packer 构建的本地 VM?
How start a local VM built by packer?
我是打包机的新手。
首先,我尝试构建:https://github.com/shiguredo/packer-templates/tree/develop/ubuntu-14.04,效果很好。但是当我想通过 vagrant up
解决它时,我收到以下错误:
Vagrant environment or target machine is required to run this
command. Run `vagrant init` to create a new Vagrant environment. Or,
get an ID of a target machine from `vagrant global-status` to run
this command on. A final option is to change to a directory with a
Vagrantfile and to try again.
调用 vagrant init
后,创建了一个看起来像默认配置文件的配置文件。但是还是有错误:
Bringing machine 'default' up with 'parallels' provider...
==> default: Box 'base' could not be found. Attempting to find and install...
default: Box Provider: parallels
default: Box Version: >= 0
==> default: Adding box 'base' (v0) for provider: parallels
default: Downloading: base
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
Couldn't open file /Downloads/packer-templates-develop/ubuntu-14.04/base
如何在本地启动打包程序生成的 VM?
手动跟踪 Vagrantfile 是唯一的解决方案吗?
编辑:
如果我打电话给 vagrant init myNewlyCreatedBox.box
然后 vagrant 也会尝试启动 VM 但是
Failed to mount folders in Linux guest. This is usually because
the "prl_fs" file system is not available. Please verify that
Parallels Tools are properly installed in the guest and
can work properly. If so, the VM reboot can solve a problem.
The command attempted was:
mount -t prl_fs -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant
mount -t prl_fs -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant
这些模板将为您生成一个 Vagrant 框。如果该过程成功完成,您应该拥有 template.json
文件指定的 ubuntu-14-04-x64-virtualbox.box
和 ubuntu-14-04-x64-vmware.box
文件。要在 Vagrant 中使用这些新创建的框,您需要将与您的特定管理程序相对应的框添加到 Vagrant 通过以下方式了解的框列表中:
vagrant box add <nameToReferToBox> <pathToBoxYouJustCreated>
例如
vagrant box add ubuntu-14-04-x64 ubuntu-14-04-x64-virtualbox.box
然后要创建该框的实例(VM),您只需创建一个针对您刚刚导入的新框的 Vagrant 文件:
vagrant init ubuntu-14-04-x64
然后基于 base box 启动 VM:
vagrant up
我是打包机的新手。
首先,我尝试构建:https://github.com/shiguredo/packer-templates/tree/develop/ubuntu-14.04,效果很好。但是当我想通过 vagrant up
解决它时,我收到以下错误:
Vagrant environment or target machine is required to run this
command. Run `vagrant init` to create a new Vagrant environment. Or,
get an ID of a target machine from `vagrant global-status` to run
this command on. A final option is to change to a directory with a
Vagrantfile and to try again.
调用 vagrant init
后,创建了一个看起来像默认配置文件的配置文件。但是还是有错误:
Bringing machine 'default' up with 'parallels' provider...
==> default: Box 'base' could not be found. Attempting to find and install...
default: Box Provider: parallels
default: Box Version: >= 0
==> default: Adding box 'base' (v0) for provider: parallels
default: Downloading: base
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
Couldn't open file /Downloads/packer-templates-develop/ubuntu-14.04/base
如何在本地启动打包程序生成的 VM? 手动跟踪 Vagrantfile 是唯一的解决方案吗?
编辑:
如果我打电话给 vagrant init myNewlyCreatedBox.box
然后 vagrant 也会尝试启动 VM 但是
Failed to mount folders in Linux guest. This is usually because
the "prl_fs" file system is not available. Please verify that
Parallels Tools are properly installed in the guest and
can work properly. If so, the VM reboot can solve a problem.
The command attempted was:
mount -t prl_fs -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant
mount -t prl_fs -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant
这些模板将为您生成一个 Vagrant 框。如果该过程成功完成,您应该拥有 template.json
文件指定的 ubuntu-14-04-x64-virtualbox.box
和 ubuntu-14-04-x64-vmware.box
文件。要在 Vagrant 中使用这些新创建的框,您需要将与您的特定管理程序相对应的框添加到 Vagrant 通过以下方式了解的框列表中:
vagrant box add <nameToReferToBox> <pathToBoxYouJustCreated>
例如
vagrant box add ubuntu-14-04-x64 ubuntu-14-04-x64-virtualbox.box
然后要创建该框的实例(VM),您只需创建一个针对您刚刚导入的新框的 Vagrant 文件:
vagrant init ubuntu-14-04-x64
然后基于 base box 启动 VM:
vagrant up