Mac(10.9.2)下安裝Vagrant。
Vagrant version: 1.3.5
VirtualBox version: 4.3.10
Box: vagrant-centos-5.10-x86_64.box
安裝完畢之後,vagrant up報錯了。。。
localhost:dev angel$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:
vm:
* The box 'tBox' could not be found.
tBox找不到。。。。
用如下命令尋找目前添加的所有鏡像。
vagrant box list
顯示如下:
localhost:dev angel$ vagrant box list
tBox (vmware_fusion)
發現了什麼, vmware_fusion,奇怪,明明我安裝的時virtualbox ????
ok, 按預設重新增加一個鏡像。
localhost:dev angel$ vagrant box add centos-5.10 ~/Downloads/vagrant-centos-5.10-x86_64.box
Downloading or copying the box...
Extracting box...te: 209M/s, Estimated time remaining: 0:00:01)
Successfully added box 'centos-5.10' with provider 'vmware_fusion'!
看到沒有,Successfully added box ‘centos-5.10' with prover 'vmware _fusion', 增加鏡像,預設provider(不知道怎麼稱呼)是”vmware_fusion“。
ok,既然發現了問題。解決的思路也有了。
重新增加一個鏡像,指定provider。如下。
localhost:dev angel$ vagrant box add --provider virtualbox centos-5.10-virtualbox ~/Downloads/vagrant-centos-5.10-x86_64.box
Downloading or copying the box...
Extracting box...te: 199M/s, Estimated time remaining: --:--:--)
The box you attempted to add doesn't match the provider you specified.
Provider expected: virtualbox
Provider of box: vmware_fusion
MyGod, 看到沒有 期望的Provider是virtualbox,而目前的使用的box是給vmware_fusion使用的。看來是下錯檔案。
到官方box鏡像網站去重新下載Provider是virtuabox的box鏡像。
下載之後重新添加box.
localhost:dev angel$ vagrant box add centos-virtualbox ~/Downloads/CentOS-56-x64-packages-puppet-2.6.10-chef-0.10.6.box
Downloading or copying the box...
Extracting box...te: 208M/s, Estimated time remaining: --:--:--)
Successfully added box 'centos-virtualbox' with provider 'virtualbox'!
vagrant up啟動成功。
localhost:dev angel$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'centos-virtualbox'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Booting VM...
[default] Waiting for machine to boot. This may take a few minutes...
[default] Machine booted and ready!
[default] The guest additions on this VM do not match the installed version of
VirtualBox! In most cases this is fine, but in rare cases it can
cause things such as shared folders to not work properly. If you see
shared folder errors, please update the guest additions within the
virtual machine and reload your VM.
Guest Additions Version: 4.2.0
VirtualBox Version: 4.3
[default] Mounting shared folders...
[default] -- /vagrant
總結:虛擬機器和鏡像檔案是有對應關係的。下載鏡像檔案需要注意下。