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、目前只記得這幾個了,以後再想起來再來補充,也歡迎大家補充。有什麼地方不對的,歡迎大家指出。

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