- 下载 vagrant
2.测试安装成功
vagrant -v
- 下载 homestead box
链接:https://pan.baidu.com/s/1KsdTZZdTlwBmQAKyRHiJGw
提取码:ql8i
复制这段内容后打开百度网盘手机App,操作更方便哦
- 新建文件 virtualbox.json 写入以下
"name": "laravel/homestead",
"versions": [{
"version": "5.1.0", // 此处根据下载的版本号做修改
"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.
- 创建 laravel 项目
composer create-project --prefer-dist laravel/laravel blog
- 安装 VirtualBox
- 启动
vagrant up
over
image.png
vagrant 常用命令
vagrant up 启动虚拟机
vagrant halt 关闭虚拟机
vagrant reload 重启虚拟机
vagrant destory 删除虚拟机
vagrant ssh 远程连接虚拟机
git配置私钥
网友评论