- 下載 vagrant
2.測試安裝成功
vagrant -v
- 下載 homestead box
鏈接:https://pan.baidu.com/s/1KsdTZZdTlwBmQAKyRHiJGw
提取碼:ql8i
復(fù)制這段內(nèi)容后打開百度網(wǎng)盤手機App斯棒,操作更方便哦
- 新建文件 virtualbox.json 寫入以下
"name": "laravel/homestead",
"versions": [{
"version": "5.1.0", // 此處根據(jù)下載的版本號做修改
"providers": [{
"name": "virtualbox",
"url": "file:///D:/phpEnv/homestead-5.1.0.box" // 本地路徑
}]
}]
}
注意 window powershell 版本 大于 2.0
- 安裝 Homestead
git clone https://github.com/laravel/homestead.git Homestead
cd Homestead
git checkout v6.1.0
init.bat
- 編輯 Homestead 文件夾下 Homestead.yaml 文件
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
# 把本地路徑映射到虛擬機上
- map: D:\phpstudy\PHPTutorial\WWW
to: /home/vagrant/code
sites:
- map: homestead.test
to: /home/vagrant/code/public
databases:
- homestead
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# zray:
# If you've already freely registered Z-Ray, you can place the token here.
# - email: foo@bar.com
# token: foo
# Don't forget to ensure that you have 'zray: "true"' for your site.
- 創(chuàng)建 laravel 項目
composer create-project --prefer-dist laravel/laravel blog
- 安裝 VirtualBox
- 啟動
vagrant up
over
vagrant 常用命令
vagrant up 啟動虛擬機
vagrant halt 關(guān)閉虛擬機
vagrant reload 重啟虛擬機
vagrant destory 刪除虛擬機
vagrant ssh 遠程連接虛擬機
git配置私鑰