一、相关软件
先安装 Composer,GIt ,VirtualBox,Vagrant
二、安装
git下载homestead
git clone https://github.com/laravel/homestead.git
进入文件目录
cd homestead
vagrant box add laravel/homestead //安装homestead
下载慢的解决方案
离线包下载:
https://atlas.hashicorp.com/laravel/boxes/homestead/versions/0.4.4/providers/virtualbox.box
vagrant box add laravel/homestead D:/virtualbox.box
初始化homestead环境
init
修改文件配置文件
C:\Users\Administrator\.homestead
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Code
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 93000
# to: 9300
# - send: 7777
# to: 777
# protocol: udp
修改为:
---
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: D:/www
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
三、开启虚拟机
vagrant up
四、错误处理
- 错误原因:缺少 .ssh/id_rsa.pub 文件
- 解决方案:生存密钥:
$ ssh-keygen -t rsa -C “chenhua@wysls.com”
作者:陈华
大学生演讲网( http://www.wysls.com )创始人
陈华编程社区:http://www.chenhua.club
陈华编程学院:http://chenhua.ke.qq.com