Windows 10下安装Vagrant遇到的错误
1 vagrant init -> vagrant up
失败, 如下:
[default] Waiting for machine to boot. This may take a few minutes...The guest machine entered an invalid state while waiting for itto boot. Valid states are 'starting, running'. The machine is in the'poweroff' state. Please verify everything is configuredproperly and try again.
If the provider you're using has a GUI that comes with it,it is often helpful to open that and watch the machine, since theGUI often has more helpful error messages than Vagrant can retrieve.For example, if you're using VirtualBox, run vagrant up
while theVirtualBox GUI is open.
按照上面的错误提示,我们打开VirtualBox,边执行vagrant up
边看VirtualBox的状态,我看到的是显示按钮处闪烁并归于启动两个字(说明启动失败)
然后在VirtualBox上直接点击启动,发现报错:
Unable to load R3 module D:\Program Files\Oracle\VirtualBox/VBoxDD.dll
复制上面错误信息google了一下,找到一些文章,说到与windows主题破解有关,与众人一样感觉很诧异,不过还是得试试,毕竟昨晚已经找了两个小时的原因也没解决问题。的确昨晚在windows 10台式机上使用vagrant之前我是用魔方里的美化大师破解了主题的,那我再将其还原吧。
少顷......
重启之后
- 执行
vagrant destroy
,一切重新开始 - 删除目录下的
Vagrantfile
vagrant init
vagrant up
- 实际上,上面的步骤我都是在PHPStorm中操作的,这里不展开了,展开又是另一个话题
结果:
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 4.2.0
default: VirtualBox Version: 5.0
==> default: Mounting shared folders...
default: /vagrant => D:/Vagrant/exercise_1
==> default: Machine already provisioned. Run vagrant provision
or use the --provision
==> default: flag to force provisioning. Provisioners marked to run always will still run.
就是启动成功了。
It's just the beginning
才开始了解vagrant,后面会是搭建开发环境的活儿(PHP MySql Nginx Redis MongoDB...
)
Why not Docker ?
一样一样来。