记录自己 WIN7 系统 Homestead 安装的坑
基础安装
VirtualBox ,夜神安卓模拟器也用的是这个,
vagrant
安装 Homestead Vagrant Box
- 执行命令
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
手动下载文件 - 再次本地安装 :
$ 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
是刚才下载的文件路径,修改成自己的就好了; - 执行
homestead/init.bat
文件,生成Homestead.yaml
配置文件; - 执行
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,还是这个错呢,可是我明明安装过了,继续找..
- 找到了资料,在
C:\Users\Administrator.WINMICR-HV2FT70\.vagrant.d\boxes\laravel-VAGRANTSLASH-homestead
中会存在0
这个文件,重命名为8.2.1
(自己对应的box版本号),应该好了吧; - 再次回到第三步->第四部,然鹅依然报错:
$ 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.
大概就是不认我手动改的呗,得,革命尚未成功,同志任需努力啊~
- 终于又找到了,有大神说要在回到第五步,修改名称后,在当前文件夹下执行命令
echo 'https://vagrantcloud.com/laravel/boxes/homestead/' > metadata_url
; vagrant up && vagrant ssh
终于是好了,记录一下.
本作品采用《CC 协议》,转载必须注明作者和本文链接