參考:https://segmentfault.com/a/1190000014350154?utm_source=tag-newest
https://www.cnblogs.com/davenkin/p/vagrant-virtualbox.html
https://laravel-china.org/topics/2090/homestead-installation-needs-to-know-some-information
https://blog.csdn.net/mrgong_/article/details/78819541
https://www.cnblogs.com/hubing/p/5933779.html
http://laravelacademy.org/post/354.html
https://www.boxueio.com/series/php7-up-and-running/episode/11
http://www.itdecent.cn/p/ae9d1261bbd8 (有最新的box下載地址)
http://www.sohu.com/a/200758610_470018 (配置homestead和phpstorm)
1、下載并安裝virtualbox,vagrant
2、安裝homestead:
git clone https://github.com/laravel/homestead.git Homestead
3、迅雷下載virtualbox(也會(huì)中斷,但可以繼續(xù)下載,比起vagrant box add laravel/homestead https://app.vagrantup.com/laravel/boxes/homestead/versions/5.2.0/providers/virtualbox.box)
鏈接:https://app.vagrantup.com/laravel/boxes/homestead/versions/6.4.0/providers/virtualbox.box
4、添加virtualbox(將virtubox.box 的下載位置改為自己的地址,反斜杠改為斜杠)
vagrant box add laravel/homestead file:///D:/download/virtubox.box
5、在安裝homestead的文件夾中
scripts\homestead.rb 把
config.vm.box_version = settings["version"] ||= ">= 6.4.0" 改為 config.vm.box_version = settings["version"] ||= ">= 0"
homestead文件夾下執(zhí)行命令:
vagrant up
6、可能犯的錯(cuò)誤:
-|禁用了virtubox的虛擬網(wǎng)絡(luò)
-|安裝了virtubox6
-|virtubox.exe沒有加入到系統(tǒng)path中
==================================================================
之前安裝的方式:
1、vagrant box add laravel/homestead
用有線以太網(wǎng)一直有連接超時(shí)的報(bào)錯(cuò),改用無限網(wǎng),速度6,7M/s,不知道是什么鬼。
2、若無法進(jìn)行上一步,則要在本地先下載box,再使用vagrant box add metadata.json添加box,會(huì)報(bào)Invalid file://hostname/, expected localhost or 127.0.0.1 or none的錯(cuò)誤。
我用的是vagrant 2.0.3 、win10 、virtualBox5.8,改成絕對(duì)路徑無效果,
網(wǎng)友其他解決方式:
一、換vagrant 2.0.2,未嘗試。
二、將metadata.json直接改成路徑,也未嘗試。
vagrant box add laravel/homestead /path/to/virtualbox.box
windows中執(zhí)行如下命令
vagrant box add laravel/homestead file:///D:/download/virtubox.box
三、vagrant box add laravel/homestead https://app.vagrantup.com/laravel/boxes/homestead/versions/5.2.0/providers/virtualbox.box (可以)
(備用地址:https://vagrantcloud.com/laravel/boxes/homestead/versions/6.4.0/providers/virtualbox.box)
3、安裝homestead:git clone https://github.com/laravel/homestead.git Homestead
4、vagrant ssh登錄到虛擬機(jī),并新建laravel項(xiàng)目(項(xiàng)目名與Homestead.yaml中的對(duì)應(yīng))
composer config -g repo.packagist composer https://packagist.phpcomposer.com
composer create-project --prefer-dist laravel/laravel code
5、配置Homestead.yaml時(shí),需注意共享文件夾的對(duì)應(yīng)

6、連接數(shù)據(jù)庫

7、哈哈

8、常用命令:
開啟homestead虛擬機(jī)
vagrant up
更改Homestead.yaml后需重新加載
vagrant reload --provision
關(guān)閉homestead虛擬機(jī)
vagrant halt
刪除homestead虛擬機(jī)
vagrant destroy
9、配置phpStorm,xDebug
php7.0 -m
sudo ln -snf /etc/php/7.0/mods-available/xdebug.ini /etc/php/7.0/cli/conf.d/20-xdebug.ini
sudo ln -snf /etc/php/7.0/mods-available/xdebug.ini /etc/php/7.0/fpm/conf.d/20-xdebug.ini
sudo service php7.0-fpm restart
sudo service nginx restart
注意端口號(hào)