环境:
- win7 x64
- powershell v2.0(查看版本
$PSVersionTable
)
搭建Homestead步骤
使用Virtualbox
1. 安装 Virtual Box
Virtual Box 官方下载
2. 安装 Vagrant
Vagrant 官方下载
使用VMware
待…
3. 在Vagrant中安装
运行下面命令
1
|
$ vagrant box add laravel/homestead
|
选择3
virtualbox
1
2
3
4
5
6
7
8
9
10
|
==> box: Loading metadata for box 'laravel/homestead'
box: URL: https://vagrantcloud.com/laravel/homestead
This box can work...
1) hyperv
2) parallels
3) virtualbox
4) vmware_desktop
$ Enter your choice: 3 # step 2
|
下载速度慢,可换其他下载器下载
右键复制链接地址
下载好后,运行命令进行安装
1
|
$ vagrant box add laravel/homestead /path/to/virtualbox.box
|
4. 安装Homestead
1
2
|
$ git clone https://github.com/laravel/homestead.git Homestead
$ cd Homested
|
切换到稳定版本,homested 发行版
1
2
|
$ git checkout v7.1.2
$ init.bat
|
5. 初始化Homestead
修改文件homestead.yaml
1
2
|
folders:
- map: ~/code # 替换为项目路径
|
6. 修改hosts
C:\Windows\System32\drivers\etc\hosts
追加如下内容
1
|
192.168.10.10 homestead.test
|
7. 启动Homestead
出现如下错误:
1
2
3
|
The version of powershell currently installed on this host is less than
the required minimum version. Please upgrade the installed version of
powershell to the minimum required version and run the command again.
|
需要更新powershell至5.x
https://docs.microsoft.com/en-us/powershell/wmf/5.1/install-configure
等待初始化完成后,访问 http://homestead.test
启动后修改homestead.yaml
文件需要更新服务
1
|
$ vagrant reload --provision
|
停止服务
参考