使用Vagrant 1.4.3从Vagrant Cloud添加盒子

3
我正在尝试在Ubuntu 14.04.1 LTS上使用vagrant 1.4.3添加vagrant box:

Vagrant 1.4.3 user@machine:~$ vagrant box add ffuenf/debian-6.0.9-amd64

但是我得到了以下错误信息:

该命令未正确调用。此命令的帮助信息如下。

显然,命令格式不正确,但我应该如何获取box呢?

https://vagrantcloud.com/ffuenf/debian-6.0.9-amd64

来自 Vagrant Cloud?

4个回答

4

vagrant box add "ffuenf/debian-6.0.9-amd64" 是你的答案。

编辑:我的上一个答案基于最新的 Vagrant 版本。在 1.4.3 版本中,你不能以这种方式添加盒子,因为它与 Vagrantcloud 不兼容。相反,你需要手动指定盒子的 URL,如下所示:

$ vagrant box add "ffuenf/debian-6.0.9-amd64" https://vagrantcloud.com/ffuenf/debian-6.0.9-amd64/version/7/provider/virtualbox.box --provider virtualbox

你应该会看到以下内容:从 URL 下载盒子:https://vagrantcloud.com/ffuenf/debian-6.0.9-amd64/version/7/provider/virtualbox.box 正在提取盒子...te: 1591k/s,剩余时间估计为:0:00:02) 已成功添加了提供程序为“virtualbox”的盒子 'ffuenf/debian-6.0.9-amd64'!


你能分享带引号的命令输出吗?你使用的是相对较旧的Vagrant,我不确定在1.4.3版本中VagrantCloud是否配置为默认存储库。在1.6.3版本中它可以正常工作。 - m1keil
@MichaelS:你是怎么决定在URL中选择“7”作为版本号的? - krlmlr
1
在vagrantcloud网站上,每个虚拟机页面右侧都有一个“版本”链接。您也可以通过在URL中添加“/version”来访问该页面。在该页面上,您可以找到所有虚拟机的完整URL。我只使用了最新的虚拟机,即第7版。 - m1keil
@MichaelS:所以你从底部开始计算列表中的项目,从1开始?(因为现在最新版本似乎是8。) - krlmlr
URL似乎已经更改,例如今天的ubuntu/trusty64的最新版本为https://atlas.hashicorp.com/ubuntu/boxes/trusty64/versions/20150909.1.0/。 我无法确定从哪里获取.box文件。 - Marius Gedminas
显示剩余4条评论

1

我曾经为此苦恼了一段时间。关键是要获取最新版本的vagrant--在我写这篇文章时是1.7.4。我使用的下载链接是:https://www.vagrantup.com/downloads.html

我正在Mac OS X 10.7.5上运行MacBook Pro。为了下载ubuntu/trusty64,我访问了https://atlas.hashicorp.com/boxes/search?utm_source=vagrantcloud.com&vagrantcloud=1网站,该网站列出了当前可用的盒子。您可以通过描述搜索盒子。例如,输入“debian”作为搜索词返回一个列表。我选择了一个盒子并按照其页面上的说明进行操作(在我的情况下,页面是https://atlas.hashicorp.com/ubuntu/boxes/trusty64)。以下是我接下来的日志:

    $ vagrant init ubuntu/trusty64
    A `Vagrantfile` has been placed in this directory. You are now
    ready to `vagrant up` your first virtual environment! Please read
    the comments in the Vagrantfile as well as documentation on
    `vagrantup.com` for more information on using Vagrant.
    $ vagrant up --provider virtualbox
    Bringing machine 'default' up with 'virtualbox' provider...
    ==> default: Box 'ubuntu/trusty64' could not be found. Attempting to find and install...
        default: Box Provider: virtualbox
        default: Box Version: >= 0
    ==> default: Loading metadata for box 'ubuntu/trusty64'
        default: URL: https://atlas.hashicorp.com/ubuntu/trusty64
    ==> default: Adding box 'ubuntu/trusty64' (v20150923.0.0) for provider: virtualbox
        default: Downloading:         https://atlas.hashicorp.com/ubuntu/boxes/trusty64/versions/20150923.0.0/providers/virtualbox.box
        default: Progress: 56% (Rate: 111k/s, Estimated time remaining: 0:28:59)

1
你需要手动查找要添加的框的URL,并使用该URL。例如,假设你想从Vagrantcloud添加框“puppetlabs/ubuntu-14.04-32-puppet”,你需要执行以下操作:
  1. 打开https://vagrantcloud.com/puppetlabs/boxes/ubuntu-14.04-32-puppet
  2. 点击右侧版本下拉菜单中的一个版本(例如,1.0.0),以进入https://vagrantcloud.com/puppetlabs/boxes/ubuntu-14.04-32-puppet/versions/1
  3. 复制并粘贴您想要使用的提供程序的框的URL。在这种情况下,对于Virtualbox,它是:https://vagrantcloud.com/puppetlabs/boxes/ubuntu-14.04-32-puppet/versions/1/providers/virtualbox.box
  4. 使用以下方式添加框的URL:

    vagrant box add "puppetlabs/ubuntu-14.04-32-puppet" https://vagrantcloud.com/puppetlabs/boxes/ubuntu-14.04-32-puppet/versions/1/providers/virtualbox.box --provider virtualbox


0

这不完全是你问题的答案,但我使用了:
vagrant box add precise32 http://files.vagrantup.com/precise32.box
然后只需在配置文件(Vagrantfile)中将ffuenf/debian-6.0.9-amd64名称更改为precise32。看起来它正在正常运行。可能有一个ffuenf的盒子文件,但我不知道。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接