homestead 入坑安装

1、在使用 Homestead 之前,需要先安装 Virtual BoxVMWareParallels 或 Hyper-V (四选一,我们通常选择 VirtualBox,因为只有它是免费的)以及 Vagrant,所有这些软件包都为常用操作系统提供了一个便于使用的可视化安装器,通过安装界面引导就可以完成安装

2、安装vagrant box 

//自动下载:
vagrant box add laravel/homestead

//指定box目录安装
vagrant box add laravel/homestead ~/Downloads/virtualbox.box //这样添加盒子它的版本 名字等信息添加不到,正确的是通过json文件添加,在注意中我特殊说明了这个json文件内容

//正确如下

vagrant box add laravel/homestead ~/Downloads/metadata.json

3、 安装homestead 

cd ~
git clone https://github.com/laravel/homestead.git Homestead

   cd ~/Homestead

   // 检出指定版本...
   git checkout v9.1.0

  

注意:

  1. 要生成git秘钥
    //会报错  Check your Homestead.yaml file, the path to your private key does not exist.
    ssh-keygen -t rsa -b 4096 -C "[email protected]" eval "$(ssh-agent -s)" ssh-add -K ~/.ssh/id_rsa
  2. homestead 版本和vagrant 版本要相匹配,每个homestead版本在执行vagrant up命令开始会提示它对vagrant box的版本要求         

          

         3. vagrant box配套文件metadata.json中配置它的名字路径信息

{
    "name": "laravel/homestead",//名字
    "versions": 
    [
        {
            "version": "8.1.0",//版本
            "providers": [
                {
                  "name": "virtualbox",
                  "url": "virtualbox.box"//路径
                }
            ]
        }
    ]
}

  

猜你喜欢

转载自www.cnblogs.com/guiyishanren/p/12176576.html