mac 安装laravel/homestead

  1. 安装VirtualBox
  2. 安装Vagrant 
  3. 添加VagrantBox 
    • vagrant box add laravel/homestead
  4. 安装Homestead 管理配置,安装在用户根目录。
    • 修改配置文件 ~/.homestead/Homestead.yaml
    • 修改配置文件 ~/Homestead/script/homestead.rb
  5. 虚拟机管理,进入Homestead目录
    • 启动虚拟机 vagrant up
    • 加载配置文件 vagrant provision
    • 关闭虚拟机 vagrant halt
    • 卸载虚拟机(小心操作) vagrant destroy --force
  6. 其他设置
  7. 端口映射
    • SSH: 2222 → Forwards To 22
    • HTTP: 8000 → Forwards To 80
    • HTTPS: 44300 → Forwards To 443
    • MySQL: 33060 → Forwards To 3306
    • Postgres: 54320 → Forwards To 5432
  8. ssh及数据库的账号密码
    • homestead/secret

VagrantBox 包含以下软件

  • Ubuntu 14.04
  • PHP 5.6
  • HHVM
  • Nginx
  • MySQL
  • Postgres
  • Node (With Bower, Grunt, and Gulp)
  • Redis
  • Memcached
  • Beanstalkd
  • Laravel Envoy
  • Blackfire Profile

安装Homestead 管理配置,安装在用户根目录

git clone https://github.com/laravel/homestead.git Homestead 
cd Homestead 
bash init.sh #创建配置文件
~/.homestead/Homestead.yaml

修改配置文件 ~/Homestead/script/homestead.rb

#config.vm.network :private_network, ip: settings["ip"] ||= "192.168.10.10"
config.vm.network "private_network", :bridge => "en0: Wi-Fi (Airport)", :ip => "192.168.1.113"

修改配置文件 ~/.homestead/Homestead.yaml

ip: “192.168.10.113" #本地IP
memory: 2048 #虚拟机内存分配
cpus: 1 #cpu核
provider: virtualbox #vm

authorize: ~/.ssh/id_rsa.pub #ssh 登录公匙

keys:
    - ~/.ssh/id_rsa#ssh 登录私匙

#文件夹同步
folders:
    - map: ~/Code #本地目录
      to: /home/vagrant/Code #映射到虚拟机上的目录
      type: “nfs” #nfs同步目录文件内容
#网站虚拟域名配置
sites:
    - map: homestead.app #域名
      to: /home/vagrant/Code/Laravel/public #指向目录

你可能感兴趣的:(laravel,homestead)