Muh*_*min 54 vagrant vagrantfile
我想从Atlas下载一个流浪盒文件,以便稍后在我的vagrant文件中使用它.我该怎么做,我该如何配置它?
Muh*_*min 114
要下载文件,您必须在URL中添加版本和提供程序.例如,下载trusty64首先你需要它的URL是 https://app.vagrantup.com/ubuntu/boxes/trusty64/
然后你必须添加版本和提供程序,对于我们的示例,下载URL将是.
https://app.vagrantup.com/ubuntu/boxes/trusty64/versions/20180206.0.0/providers/virtualbox.box
然后你必须从你的vagrant文件本地添加它.
要将其本地添加到vagrant文件,请使用以下命令
vagrant box add foo-box /path/to/vagrant-box.box
vagrant init foo-box
vagrant up
Run Code Online (Sandbox Code Playgroud)
这将创建vagrantfile,您可以配置vagrant文件.
Ram*_*ils 30
但是,这会将该框添加为版本0.
? ? vagrant box add ubuntu/trusty64 ~/Downloads/trusty-server-cloudimg-amd64-vagrant-disk1.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'ubuntu/trusty64' (v0) for provider:
box: Unpacking necessary files from: file:///Users/ram/Downloads/trusty-server-cloudimg-amd64-vagrant-disk1.box
==> box: Successfully added box 'ubuntu/trusty64' (v0) for 'virtualbox'!
Run Code Online (Sandbox Code Playgroud)
vagrant不允许指定手动添加的框的版本号
? ? vagrant box add ubuntu/trusty64 ~/Downloads/trusty-server-cloudimg-amd64-vagrant-disk1.box --box-version 20151021.0.0
==> box: Box file was not detected as metadata. Adding it directly...
You specified a box version constraint with a direct box file
path. Box version constraints only work with boxes from Vagrant
Cloud or a custom box host. Please remove the version constraint
and try again.
Run Code Online (Sandbox Code Playgroud)
要更新该框的版本号,请将〜/ .vagrant.d/boxes/ubuntu-VAGRANTSLASH-trusty64/0中的文件夹名称"0"更改为您下载的版本号.例如'20160120.0.0'
|2.2.3| MacBook-Pro in ~/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-trusty64
? ? mv 0 20160120.0.0
Run Code Online (Sandbox Code Playgroud)
现在你已经准备好下次用vagrant命令更新版本了
? ? vagrant box list
ubuntu/trusty64 (virtualbox, 20160120.0.0)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
53466 次 |
| 最近记录: |