简体   繁体   English

与Vagrant Homestead的SSH连接超时

[英]SSH connection to Vagrant Homestead box times out

I am learning how to use Laravel 4.2, which comes ready to use Homestead. 我正在学习如何使用Laravel 4.2,它准备好使用Homestead。 I previously used Apache to learn Laravel locally. 我以前用Apache在本地学习Laravel。 While setting up Homestead using the official docs , I keep encountering a timeout. 在使用官方文档设置Homestead时,我一直遇到超时。

I am using Vagrant 1.6.3, the latest release of Homestead (as of 10 July 2014), PHP 5.5.3 (which should not matter since I am using Vagrant I suppose?), and Laravel 4.2. 我正在使用Vagrant 1.6.3,Homestead的最新版本(截至2014年7月10日),PHP 5.5.3(因为我使用的是Vagrant,这应该不重要?)和Laravel 4.2。

I use the following Vagrantfile : 我使用以下Vagrantfile

VAGRANTFILE_API_VERSION = "2"

path = "#{File.dirname(__FILE__)}"

require 'yaml'
require path + '/scripts/homestead.rb'

Vagrant.configure("1") do |config|
  config.vm.boot_mode = :gui
end
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  Homestead.configure(config, YAML::load(File.read(path + '/Homestead.yaml')))
end

I use the following Homestead.yaml : 我使用以下Homestead.yaml

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

authorize: /home/alex/.ssh/id_rsa.pub

keys:
    - /home/alex/.ssh/id_rsa

folders:
    - map: /home/alex/repos/www
      to: /home/vagrant/repos/www

sites:
    - map: homestead.app
      to: /home/vagrant/repos/www/learning/public

My /etc/hosts file contains the following line: 我的/etc/hosts文件包含以下行:

127.0.0.1   learning.app

When I call vagrant up , I receive the following output: 当我调用vagrant up ,我收到以下输出:

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 80 => 8000 (adapter 1)
    default: 3306 => 33060 (adapter 1)
    default: 5432 => 54320 (adapter 1)
    default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> 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...
[[17 more failed attempts]]
    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.

Could my previous set up of Apache be interfering? 我之前设置的Apache是​​否会干扰? Did I miss something? 我错过了什么? Thank you. 谢谢。

I had the same problem 'Time out...', until I figured out that the Virtualization Compatibility was disabled in the BIOS of my computer. 我有同样的问题'超时......',直到我发现在我的电脑的BIOS中禁用了虚拟化兼容性。 Source this phorum. 来源这个phorum。 http://laravel.io/forum/05-18-2014-trouble-getting-homestead-to-start-in-windows?page=1#reply-9067 http://laravel.io/forum/05-18-2014-trouble-getting-homestead-to-start-in-windows?page=1#reply-9067

Fixed that it worked perfectly. 修正了它的完美运作。

Turn on the VirtualBox GUI and you will be able to better see what is causing your problem. 打开VirtualBox GUI,您将能够更好地查看导致问题的原因。 Here are some instructions on how to do it two ways (you will need to do this either on the Vagrantfile file or on the homestead.rb file): 以下是有关如何以两种方式执行此操作的一些说明(您需要在Vagrantfile文件或homestead.rb文件中执行此操作):

enabling gui in Vagrantfile settings 在Vagrantfile设置中启用gui

That should allow you to see the actual boot screen and watch it go. 这应该可以让你看到实际的启动屏幕并观察它。

Are you running Vagrant on a linux host? 你在Linux主机上运行Vagrant吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM