window10 安装 Laravel/Homestead
2017-08-02 03:56
661 查看
安装前自定google.com VirtualBox vagrant (依赖)傻瓜式安装这俩货
因为中国的对外国网络资源的限制,你要下载这个文件可能会需要不少的时间
因此 , 在这我们拥有两个选择的余地
选择一 : 当你使用官方下载命令时,你的终端会显示这个文件的源地址复制,然后按 ctrl +c 退出,然后用的喜欢的下载软件下载.
选择二 : phphub上的 virtualbox.box
这个方式指定box也可以:
在 Homestead 目录下自定义创建的config.json 文件,用来指定box (config.json 名字随便定义)
输入指定.box命令
遇到错误:
解决办法:
以管理员身份运行shell
跑 vagrant destroy
启动Virtual Box,并确保在虚拟机列表中没有与该错误相关的虚拟机
转到“C:\ Users \ \ VirtualBox VMs”,并删除与错误相关的所有虚拟机
在shell中作为管理员运行 vagrant up
这个问题似乎在于事实已经是一个虚拟机,无法修改b / c的权限/权限。
如遇到解决方法:
解决办法:
把上方所创建的config.json 文件版本改成 “version”: “3.0.0” ,因为他会自动检查版本,小于3.0就给你下载,下载下着就死了,你版本改成3.0.0就可以避免这个坑~
注意,如果报错 ssh authorize 找不到,或者为空可执行以下命令再操作
// ssh-keygen -t rsa -C “you eamil @gamil.com”
// 会生成 id_rsa.pub && id_rsa
提示建议:下载cmder比较方便,如果你真美办法了,VirtualBox vagrant 都重新安装可能就ok,顺便把.ssh 下面的生成的秘钥文件也全部删除重试,包括 .shh文件夹
1. window bios 开启vt模式
2. 然后 vagrant box add laravel/homestead 运行命令
建议:因为中国的对外国网络资源的限制,你要下载这个文件可能会需要不少的时间
因此 , 在这我们拥有两个选择的余地
选择一 : 当你使用官方下载命令时,你的终端会显示这个文件的源地址复制,然后按 ctrl +c 退出,然后用的喜欢的下载软件下载.
选择二 : phphub上的 virtualbox.box
这个方式指定box也可以:
在 Homestead 目录下自定义创建的config.json 文件,用来指定box (config.json 名字随便定义)
{ "name": "laravel/homestead", "versions": [{ "version": "3.0.0", //注意,如果他提示升级(下半天over),可以把版本提高,不一定就是源版本,下载提示代码) "providers": [{ "name": "virtualbox", "url": "D:/virtualbox.box" //下载.box文件地址 }] }] }
输入指定.box命令
//config.json 就是自定义创建的文件~输入命令绑定.box镜像文件 vagrant box add config.json
3. 进入要创建homestead git clone https://github.com/laravel/homestead.git Homestead
//切换目录 cd Homestead // 检出所需要的版本... git checkout v5.4.0`
4 配置 Homestead
Homestead.yaml 文件,用来配置laravel 共享目录,设定ip等..( google search 教学)
--- ip: "192.168.99.10" memory: 2048 cpus: 1 provider: virtualbox authorize: ~/.ssh/id_rsa.pub keys: - ~/.ssh/id_rsa folders: - map: D:/LaravelService/project to: /home/vagrant/ sites: - map: blog.app to: /home/vagrant/HuaiseBlog/public databases: - homestead # blackfire: # - id: foo # token: bar # client-id: foo # client-token: bar # ports: # - send: 50000 # to: 5000 # - send: 7777 # to: 777 # protocol: udp
Vagrantfile 文件,可参考
# -*- mode: ruby -*- # vi: set ft=ruby : require 'json' require 'yaml' VAGRANTFILE_API_VERSION ||= "2" confDir = $confDir ||= File.expand_path(File.dirname(__FILE__)) homesteadYamlPath = confDir + "/Homestead.yaml" homesteadJsonPath = confDir + "/Homestead.json" afterScriptPath = confDir + "/after.sh" aliasesPath = confDir + "/aliases" require File.expand_path(File.dirname(__FILE__) + '/scripts/homestead.rb') Vagrant.require_version '>= 1.9.0' Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| if File.exist? aliasesPath then config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases" config.vm.provision "shell" do |s| s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases" end end if File.exist? homesteadYamlPath then settings = YAML::load(File.read(homesteadYamlPath)) elsif File.exist? homesteadJsonPath then settings = JSON.parse(File.read(homesteadJsonPath)) else abort "Homestead settings file not found in #{confDir}" end Homestead.configure(config, settings) if File.exist? afterScriptPath then config.vm.provision "shell", path: afterScriptPath, privileged: false end if defined? VagrantPlugins::HostsUpdater config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] } end # 这里需要注意,这里是我自定义编写的,里面有我加载依赖安装的php7等.. 如果报错不存在php7.1 或者其他可以用这还重方式, recipe.rb 是自定义创建文件 # config.vm.provision "chef_apply" do |chef| # #chef.recipe = File.read("./recipe.rb") # end end
配置完成后 启动 Vagrant Box
//使用该命令跑创建 vagrant up //如果报错之后的操作请用 vagrant reload --provision
遇到错误:
Bringing machine 'homestead-7' up with 'virtualbox' provider... ==> homestead-7: Checking if box 'laravel/homestead' is up to date... ==> homestead-7: Setting the name of the VM: homestead-7 The name of your virtual machine couldn't be set because VirtualBox is reporting another VM with that name already exists. Most of the time, this is because of an error with VirtualBox not cleaning up properly. To fix this, verify that no VMs with that name do exist (by opening the VirtualBox GUI). If they don't, then look at the folder in the error message from VirtualBox below and remove it if there isn't any information you need in there. VirtualBox error: VBoxManage.exe: error: Could not rename the directory 'C:\Users\lenovo\VirtualBox VMs\settler_default_1479766368381_71839_1501614406942_94872' to 'C:\Use rs\lenovo\VirtualBox VMs\homestead-7' to save the settings file (VERR_ALREADY_EXISTS) VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component SessionMachine, interface IMachine, callee IUnknown VBoxManage.exe: error: Context: "SaveSettings()" at line 3060 of file VBoxManageModifyVM.cpp
解决办法:
以管理员身份运行shell
跑 vagrant destroy
启动Virtual Box,并确保在虚拟机列表中没有与该错误相关的虚拟机
转到“C:\ Users \ \ VirtualBox VMs”,并删除与错误相关的所有虚拟机
在shell中作为管理员运行 vagrant up
这个问题似乎在于事实已经是一个虚拟机,无法修改b / c的权限/权限。
如遇到解决方法:
Bringing machine 'homestead-7' up with 'virtualbox' provider... ==> homestead-7: Box 'laravel/homestead' could not be found. Attempting to find and install... homestead-7: Box Provider: virtualbox homestead-7: Box Version: >= 3.0.0 ==> homestead-7: Loading metadata for box 'laravel/homestead' homestead-7: URL: https://vagrantcloud.com/laravel/homestead ==> homestead-7: Adding box 'laravel/homestead' (v3.0.0) for provider: virtualbox homestead-7: Downloading: https://vagrantcloud.com/laravel/boxes/homestead/versions/3.0.0/providers/virtualbox.box homestead-7: Progress: 0% (Rate: 0curl:/s, Estimated time remaining: --:--:--) An error occurred while downloading the remote file. The error message, if any, is reproduced below. Please fix this error and try again. Failed to connect to vagrantcloud-files-production.s3.amazonaws.com port 443: Timed out
解决办法:
把上方所创建的config.json 文件版本改成 “version”: “3.0.0” ,因为他会自动检查版本,小于3.0就给你下载,下载下着就死了,你版本改成3.0.0就可以避免这个坑~
注意,如果报错 ssh authorize 找不到,或者为空可执行以下命令再操作
// ssh-keygen -t rsa -C “you eamil @gamil.com”
// 会生成 id_rsa.pub && id_rsa
提示建议:下载cmder比较方便,如果你真美办法了,VirtualBox vagrant 都重新安装可能就ok,顺便把.ssh 下面的生成的秘钥文件也全部删除重试,包括 .shh文件夹
相关文章推荐
- Window10 下安装 Laravel / Homestead 视频
- Ubuntu下Laravel的开发环境安装及部署(Vagrant + Homestead)
- 安装Laravel Homestead
- win10 下 Laravel 虚拟开发环境 Homestead 安装教程
- Windows 10下Laravel的开发环境安装及部署(Vagrant + Homestead)
- Laravel 虚拟开发环境Homestead安装
- 有关Laravel 4 的 Homestead 安装部署的细节
- Homestead 安装 phpMyAdmin 作为数据库管理客户端 — Laravel 实战 iBrand API 教程
- windows 安装laravel homestead后,卡在SSH auth method: private key
- Laravel环境配置之安装Homestead
- 如何在 Windows 上安装 Laravel Homestead
- windows 安装laravel Homestead
- Windows 10下Laravel的开发环境安装及部署(Vagrant + Homestead)
- laravel homestead vagrant box安装使用,问题,及相关命令
- windows10 安装Laravel Homestead
- laravel homestead vagrant box安装使用,问题,及相关命令
- 已经安装'laravel/homestead' box,但是执行homestead up时提示找不到box,怎么办?
- 使用Vgrant安装Homestead构建Laravel环境
- 在Homestead虚拟机上安装laravel5.5