Windows下安装homestead常见问题详解

1、添加homestead box 到vagrant失败:

原因:外网资源受到限制,下载很慢,而且很可能下载失败。

解决:当我们正常情况下输入命令:vagrant box add laravel/homestead 时,若下载失败,会有相应的下载地址

           

我们复制下这个下载地址,然后打开自己的下载工具,进行下载即可,文件大概800多兆。网上有人说用迅雷下载下来的文件是被损坏的,不过我就是用的迅雷下载,下载的文件是可以用的。我们可以将下载下来的文件命名为virtualbox.box,也可以命名为别的名字,这不重要,重要的是,我们需要记住这个文件名字及所在位置。然后使用命令:vagrant box add laravel/homestead file:/// d:/virtualbox.box  在这个命令命令中,file:/// 后面内容即为我们下载的box文件所在位置,此时运行即可添加成功。


2、启动虚拟机命令 vagrant up 停止在如下界面:

Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.

原因:未开启虚拟化,原因可能不仅只有这一个,我遇到的是未开启虚拟化,如果以后遇到别的原因我会来补充。

解决:首先我们查看是否开启虚拟化:打开任务管理器->性能->CPU->虚拟化

若虚拟化后方显示为禁用:则需我们手动打开。打开方式如下:电脑重启进入BIOS->Configuration->Intel Virtualization Technology ,选择Enabled,然后按enter 确定,最后按F10选择YES保存退出。开机后进入任务管理器查看虚拟化显示“已开启”,此时再尝试命令vagrant up开启虚拟机。


3、开启虚拟机命令vagrant up命令失败,提示找不到box,但是在问题1中我们已经成功下载了box文件:


原因:上图中,virtualbox 版本为0.3.0,大家各自安装的版本有所差异,这个会根据安装的版本显示。我们之前在问题1中使用的命令vagrant box add laravel/homestead file:/// d:/virtualbox.box 结果是vagrantbox 版本为0 ,这个原因我还没有搞清楚,但是下载好显示的确实是version 0 ,这个大家在问题1中添加成功可以看命令行的最后一行。

解决:打开homestead.rb文件,该文件路径为homestead/scripts/homestead.rb,修改config.vm.box_version = settings["version"] || = ">= 0.3.0" 改为 config.vm.box_version = settings["version"] || = ">=0",即可。


4、目前只记得这几个了,以后再想起来再来补充,也欢迎大家补充。有什么地方不对的,欢迎大家指出。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章