记录自己 WIN7 系统 Homestead 安装的坑

基础安装

VirtualBox ,夜神安卓模拟器也用的是这个,
vagrant

安装 Homestead Vagrant Box

  1. 执行命令 vagrant box add laravel/homestead,报错:
    $ vagrant box add laravel/homestead
    ==> box: Loading metadata for box 'laravel/homestead'
    box: URL: https://vagrantcloud.com/laravel/homestead
    ==> box: Adding box 'laravel/homestead' (v8.2.1) for provider: virtualbox
    box: Downloading: https://vagrantcloud.com/laravel/boxes/homestead/versions/8.2.1/providers/virtualbox.box
    box: Download redirected to host: vagrantcloud-files-production.s3.amazonaws.com
    box:
    An error occurred while downloading the remote file. The error
    message, if any, is reproduced below. Please fix this error and try
    again.
    Could not resolve host: vagrantcloud-files-production.s3.amazonaws.com

    直接复制下载地址:https://vagrantcloud.com/laravel/boxes/homestead/versions/8.2.1/providers/virtualbox.box手动下载文件

  2. 再次本地安装 :
    $ vagrant box add laravel/homestead ./virtualbox.box
    ==> box: Box file was not detected as metadata. Adding it directly...
    ==> box: Adding box 'laravel/homestead' (v0) for provider:
        box: Unpacking necessary files from: file://C:/Users/Administrator.WINMICR-HV2FT70/Homestead/virtualbox.box
        box:
    ==> box: Successfully added box 'laravel/homestead' (v0) for 'virtualbox'!

    貌似安装成功了吧,这里的./virtualbox.box 是刚才下载的文件路径,修改成自己的就好了;

  3. 执行homestead/init.bat文件,生成Homestead.yaml配置文件;
  4. 执行 vagrant up,报错了:
    $ vagrant up
    Bringing machine 'homestead' up with 'virtualbox' provider...
    ==> homestead: Box 'laravel/homestead' could not be found. Attempting to find and install...
        homestead: Box Provider: virtualbox
        homestead: Box Version: >= 8.0
    ==> homestead: Loading metadata for box 'laravel/homestead'
        homestead: URL: https://vagrantcloud.com/laravel/homestead
    ==> homestead: Adding box 'laravel/homestead' (v8.2.1) for provider: virtualbox
        homestead: Downloading: https://vagrantcloud.com/laravel/boxes/homestead/versions/8.2.1/providers/virtualbox.
        homestead: Download redirected to host: vagrantcloud-files-production.s3.amazonaws.com
        homestead:
    An error occurred while downloading the remote file. The error
    message, if any, is reproduced below. Please fix this error and try
    again.
    Could not resolve host: vagrantcloud-files-production.s3.amazonaws.com

    emmmm,还是这个错呢,可是我明明安装过了,继续找..

  5. 找到了资料,在 C:\Users\Administrator.WINMICR-HV2FT70\.vagrant.d\boxes\laravel-VAGRANTSLASH-homestead中会存在 0这个文件,重命名为8.2.1(自己对应的box版本号),应该好了吧;
  6. 再次回到第三步->第四部,然鹅依然报错:
    $ vagrant up
    Bringing machine 'homestead' up with 'virtualbox' provider...
    ==> homestead: Importing base box 'laravel/homestead'...
    ==> homestead: Matching MAC address for NAT networking...
    ==> homestead: Checking if box 'laravel/homestead' version '8.2.1' is up to date...
    The box 'laravel/homestead' is not a versioned box. The box was added
    directly instead of from a box catalog. Vagrant can only
    check the versions of boxes that were added from a catalog
    such as from the public Vagrant Server.

    大概就是不认我手动改的呗,得,革命尚未成功,同志任需努力啊~

  7. 终于又找到了,有大神说要在回到第五步,修改名称后,在当前文件夹下执行命令 echo 'https://vagrantcloud.com/laravel/boxes/homestead/' > metadata_url;
  8. vagrant up && vagrant ssh

记录自己WIN7系统homestead安装的坑
终于是好了,记录一下.

本作品采用《CC 协议》,转载必须注明作者和本文链接
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!