Laravel Homestead不工作,它只是暂时停止

时间:2015-01-04 22:50:26

标签: laravel vagrant virtualbox laravel-5 homestead

我正在尝试在Windows 8.1 x64上设置Laravel Homestead,我似乎无法通过下面的错误。

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'laravel/homestead'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Setting the name of the VM: casensitive_default_1420409560257_10693
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...

Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.

这是与Homestead的非常受欢迎的错误,我在stackoverflow上发现了几个类似的帖子,例如:onetwo。但是在我的Vagrantfile中设置boot_mode并没有解决问题。

Vagrant.configure("1") do |config|
  config.vm.boot_mode = :gui
end

为了确保我有VT-x I downloaded intels工具,我这样做:i7核心;我检查了在BIOS中启用了虚拟化。

在Vagrantfile中,我使用的是默认值(大部分都是注释掉的),我将config.vm.box设置为:

"laravel/homestead"

我的Homestead.yaml设置为(并且已经有id_ras.pub和id_rsa):

---
ip: "192.168.10.10"
memory: 2048
cpus: 1

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/d/projects
      to: /home/vagrant/projects

sites:
    - map: roopla.app
      to: /home/vagrant/projects/test_app/public

databases:
    - homestead

variables:
    - key: APP_ENV
      value: local

这远远超出了我的正常作曲家,PHP,GruntJS,BowerJS,AngularJS那天,我不确定我在做什么,最初我只是学习Laravel 4/5然后我跳了一边因为宅基地看起来很有用,所以我只是盲目地遵循指示,所以任何可以传授的知识片段都会受到高度赞赏。

1 个答案:

答案 0 :(得分:0)

首先,请确保您没有开启Hyper-V

其次,可能你的ssh键有问题。最简单的解决方案是改变您的流浪文件,不要使用SSH密钥,而是使用登录名和密码。

看看我的vagrantfile:

require 'json'
require 'yaml'

VAGRANTFILE_API_VERSION = "2"

homesteadYamlPath = File.expand_path("Homestead.yaml")
afterScriptPath = File.expand_path("after.sh")
aliasesPath = File.expand_path("aliases")

require_relative 'scripts/homestead.rb'

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    if File.exists? aliasesPath then
        config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases"
    end

    config.ssh.username = "vagrant"
    config.ssh.password = "vagrant"   

    Homestead.configure(config, YAML::load(File.read(homesteadYamlPath)))    

    if File.exists? afterScriptPath then
        config.vm.provision "shell", path: afterScriptPath
    end

    config.vm.network "forwarded_port", guest: 11300, host: 11301
end

我在这里添加了2行:

    config.ssh.username = "vagrant"
    config.ssh.password = "vagrant"  

因为我遇到了和你一样的问题,现在Homestead对我没有任何问题。