Windows Homestead环境搭建

一、安装配置:

•  Laravel 开发环境的安装及配置的步骤:

• 安装 VirtualBox ( https://www.virtualbox.org/wiki/Downloads 官网下载)

• 安装 Vagrant (  https://www.vagrantup.com/downloads.html 官网下载 )

• 导入 Homestead Box 虚拟机盒子

• 安装 Git 或者使用Codinghttps://coding.net/ 

• 安装 Homestead 管理脚本

• 配置 Homestead.yaml 文件

---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa
    - ~/.ssh/id_rsa.pub

folders:
    - map: E:/WWW
      to: /home/vagrant/Code

sites:
    - map: laravel.test
      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: 50000
#       to: 5000
#     - send: 7777
#       to: 777
#       protocol: udp

• 启动 Homestead 虚拟机

• 安装和使用Homestead

• Composer全局配置:$ composer config –g repo.packagist composer https://packagist.laravel-china.org(推荐使用)

备注:Windows 系统在安装 Homestead 的时候报错:Visual C++ 2010 x86 Redistributables (即vcredist_x86.exe

重点:(不能强制关虚拟机,安装软件时最好默认路径,hosts文件不需要后缀,不是txt格式)

启动homestead虚拟机:cd ~/Homestead && vagrant up  

vagrant ssh

   退出虚拟机:exit       vagrant halt

二、Homestead 虚拟机里的 MySQL 数据库服务器连接方式为:

· Host: 127.0.0.1

· Port: 33060

· User: homestead

· Pass: secret

猜你喜欢

转载自blog.csdn.net/qq_39188306/article/details/80373041
今日推荐