2019独角兽企业重金招聘Python工程师标准>>>
C:\Users\Samuel>vagrant box add laravel/homestead
==> box: Loading metadata for box 'laravel/homestead'
box: URL: https://atlas.hashicorp.com/laravel/homestead
This box can work with multiple providers! The providers that it
can work with are listed below. Please review the list and choose
the provider you will be working with.
1) parallels
2) virtualbox
3) vmware_desktop
Enter your choice: 2
==> box: Adding box 'laravel/homestead' (v1.1.0) for provider: virtualbox
box: Downloading: https://atlas.hashicorp.com/laravel/boxes/homestead/versions/1.1.0/providers/virtualbox.box
==> box: Box download is resuming from prior download progress
box: Progress: 0% (Rate: 25d/s, Estimated time remaining: 0:03:25)40))
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
SSL read: error:00000000:lib(0):func(0):reason(0), errno 10054
目前laravel/homestead对应最新vagrant box版本是v1.1.0
下载地址:
https://atlas.hashicorp.com/laravel/boxes/homestead/versions/1.1.0/providers/virtualbox.box
1.下载完成后文件名为:hc-download(自定义)
执行vagrant box add命令进行安装
vagrant box add laravel/homestead F:\software\hc-download
C:\Users\Samuel>vagrant box add laravel/homestead F:\software\hc-download
==> 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:///F:/software/hc-download
box: Progress: 100% (Rate: 7963k/s, Estimated time remaining: --:--:--)
==> box: Successfully added box 'laravel/homestead' (v0) for 'virtualbox'!
2.本地安装box 时不能指定版本号,测试结果如下:
C:\Users\Samuel>vagrant box add laravel/homestead F:\software\hc-download --box-version 1.1.0
==> box: Box file was not detected as metadata. Adding it directly...
You specified a box version constraint with a direct box file
path. Box version constraints only work with boxes from Vagrant
Cloud or a custom box host. Please remove the version constraint
and try again.
(vagrant box add
(vagrant box add box名字 box本地路径 指定版本号选项 版本号)
安装完box后,安装homestead
git clone https://github.com/laravel/homestead.git myhomestead
vagrant init
vagrant up
执行结果:
H:\myhomestead>vagrant up
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: >= 1.1.0
==> homestead-7: Loading metadata for box 'laravel/homestead'
homestead-7: URL: https://atlas.hashicorp.com/laravel/homestead
==> homestead-7: Adding box 'laravel/homestead' (v1.1.0) for provider: virtualbox
homestead-7: Downloading: https://atlas.hashicorp.com/laravel/boxes/homestead/versions/1.1.0/providers/virtualbox.box
==> homestead-7: Box download is resuming from prior download progress
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.
Unknown SSL protocol error in connection to atlas.hashicorp.com:443
又重新去通过url安装box。。。
若要正常启动vagrant需要修改H:\myhomestead\scripts\homestead.rb文件
18行源代码:
config.vm.box_version = settings["version"] ||= ">= 1.1.0"
修改后:
config.vm.box_version = settings["version"] ||= "0"
此时再启动vagrant,正常
H:\myhomestead>vagrant up
Bringing machine 'homestead-7' up with 'virtualbox' provider...
==> homestead-7: Importing base box 'laravel/homestead'...
==> homestead-7: Matching MAC address for NAT networking...
==> homestead-7: Setting the name of the VM: homestead-7
==> homestead-7: Clearing any previously set network interfaces...
==> homestead-7: Preparing network interfaces based on configuration...
homestead-7: Adapter 1: nat
homestead-7: Adapter 2: hostonly
==> homestead-7: Forwarding ports...
homestead-7: 80 (guest) => 8000 (host) (adapter 1)
homestead-7: 443 (guest) => 44300 (host) (adapter 1)
homestead-7: 3306 (guest) => 33060 (host) (adapter 1)
homestead-7: 5432 (guest) => 54320 (host) (adapter 1)
homestead-7: 27017 (guest) => 27017 (host) (adapter 1)
homestead-7: 22 (guest) => 2222 (host) (adapter 1)
==> homestead-7: Running 'pre-boot' VM customizations...
==> homestead-7: Booting VM...
==> homestead-7: Waiting for machine to boot. This may take a few minutes...
homestead-7: SSH address: 127.0.0.1:2222
homestead-7: SSH username: vagrant
homestead-7: SSH auth method: private key
homestead-7: Warning: Remote connection disconnect. Retrying...
homestead-7:
homestead-7: Vagrant insecure key detected. Vagrant will automatically replace
homestead-7: this with a newly generated keypair for better security.
homestead-7:
homestead-7: Inserting generated public key within guest...
homestead-7: Removing insecure key from the guest if it's present...
homestead-7: Key inserted! Disconnecting and reconnecting using new SSH key...
==> homestead-7: Machine booted and ready!
==> homestead-7: Checking for guest additions in VM...
homestead-7: The guest additions on this VM do not match the installed version of
homestead-7: VirtualBox! In most cases this is fine, but in rare cases it can
homestead-7: prevent things such as shared folders from working properly. If you see
homestead-7: shared folder errors, please make sure the guest additions within the
homestead-7: virtual machine match the version of VirtualBox you have installed on
homestead-7: your host and reload your VM.
homestead-7:
homestead-7: Guest Additions Version: 5.1.10
homestead-7: VirtualBox Version: 5.0
==> homestead-7: Setting hostname...
==> homestead-7: Configuring and enabling network interfaces...
==> homestead-7: Mounting shared folders...
homestead-7: /vagrant => H:/myhomestead
homestead-7: /home/vagrant/Code => H:/www
==> homestead-7: Running provisioner: file...
==> homestead-7: Running provisioner: shell...
homestead-7: Running: inline script
==> homestead-7: Running provisioner: shell...
homestead-7: Running: inline script
==> homestead-7:
==> homestead-7: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDCBV0zuqx7SVltBG5p0fbDnSG9Ojqou9pkUdTuqLDEHKcjQVOntNXiWidw6guj17kSLzyRQ/AJ2JTWJ3WRGzw53FkUTDUcWXPqXXhJ5Y
cEi0ZX1ql35HgLvFfwsvWUfEd5OxENai993+nHMXM8+iarw5SqqPPBcMzjR88jGjtVi5KJ9NKHuRFqI8PFmYEhr38RADtJRqY6hl8JKH6FUQbqYHN92lrPJUIHtta1b/fe7gZ8B6pI/1S5M2g0MXvM27g75F2YD
lzzWzfIImkKOjOOMlH97BtE8M7XXrFCpF4eqlJc4UyaPctKu5f6Ft9iVTenvvMWtDuYpOoSWW80EIZN [email protected]
==> homestead-7: Running provisioner: shell...
homestead-7: Running: inline script
==> homestead-7: Running provisioner: shell...
homestead-7: Running: C:/Users/Samuel/AppData/Local/Temp/vagrant-shell20170212-10796-1ds1bk2.sh
==> homestead-7: Running provisioner: shell...
homestead-7: Running: script: Creating Site: sample.app
==> homestead-7: Running provisioner: shell...
homestead-7: Running: script: Restarting Nginx
==> homestead-7: Running provisioner: shell...
homestead-7: Running: script: Creating MySQL Database: homestead
==> homestead-7: Running provisioner: shell...
homestead-7: Running: script: Creating Postgres Database: homestead
==> homestead-7: Running provisioner: shell...
homestead-7: Running: script: Creating MySQL Database: sample
==> homestead-7: Running provisioner: shell...
homestead-7: Running: script: Creating Postgres Database: sample
==> homestead-7: Running provisioner: shell...
homestead-7: Running: script: Clear Variables
==> homestead-7: Running provisioner: shell...
homestead-7: Running: script: Update Composer
==> homestead-7: You are already using composer version 1.3.2 (stable channel).
==> homestead-7: Running provisioner: shell...
homestead-7: Running: C:/Users/Samuel/AppData/Local/Temp/vagrant-shell20170212-10796-16p7ypy.sh
连接到虚拟机,正常
H:\myhomestead>vagrant ssh
Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-51-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
3 packages can be updated.
0 updates are security updates.
vagrant@homestead:~$