box.json 和 离线的virtualbox.box放在一个文件夹下
--------------------------------------------------------------------------------
{
"name": "laravel/homestead",
"versions":
[
{
"version": "5.2.0",
"providers": [
{
"name": "virtualbox",
"url": "virtualbox5.2.0.box"
}
]
}
]
}
Homestead.yaml
--------------------------------------------------------------------------------
---
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
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
--------------------------------------------------------------------------------
用到的vagrant 命令
vagrant box list
vagrant box remove laravel/homestead --box-version 5.1.0 移除
vagrant status 查看状态
vagrant up 启动
vagrant halt 挂起/关机
vagrant box add box.json 安装
vagrant ssh 连接
ssh vagrant@127.0.0.1 -p 222
--------------------------------------------------------------------------------
安装所需软件
1.安装vagrant,点此进入下载页Vagrant 可以使用 迅雷下载链接 或者 百度盘下载。
2.安装Virtualbox 你可以前往 官网下载 或者使用 百度盘下载。
3.导入box vagrant box add laravel/homestead (网络环境,否则用上面的离线方法)
4.安装git git clone https://github.com/laravel/homestead.git Homestead
5.安装composer composer config -g repo.packagist composer https://packagist.phpcomposer.com