2014-07-11 89 views
1

我正在學習如何使用Laravel 4.2,它準備使用Homestead。我以前使用Apache在本地學習Laravel。在使用official docs設置Homestead時,我一直遇到超時。SSH連接到Vagrant Homestead框超時

我正在使用Vagrant 1.6.3,Homestead的最新版本(截至2014年7月10日),PHP 5.5.3(這應該不重要,因爲我使用的是流浪我猜想?)和Laravel 4.2。

我用下面的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 

我用下面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 

/etc/hosts文件包含以下行:

127.0.0.1 learning.app 

當我打電話vagrant up,我收到了這個foll由於輸出:

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. 

能阿帕奇我以前的設立被幹擾?我錯過了什麼?謝謝。

+0

你有沒有嘗試過通過vbox gui手動啓動盒子,然後通過普通shell連接到它? – Max

+0

這是我第一次使用VirtualBox進行實時操作。我如何從GUI運行Homestead框? 編輯:我打開了VirtualBox的圖形用戶界面,看到我有幾個家園箱,並試圖打開一個。它只顯示一個黑屏(現在超過五分鐘)。 – ordonezalex

+0

[Vagrant卡住連接超時重試]可能重複(http://stackoverflow.com/questions/22575261/vagrant-stuck-connection-timeout-retrying) – kenorb

回答

2

我有同樣的問題'超時...',直到我發現在我的計算機的BIOS中禁用了虛擬化兼容性。 來源於此phorum。 http://laravel.io/forum/05-18-2014-trouble-getting-homestead-to-start-in-windows?page=1#reply-9067

修正了它的工作原理。

+0

是的,我的Intel CPU中的虛擬化已被禁用。流浪/家園現在工作很好! – ordonezalex

+0

我發現這個鏈接之前來檢查問題:[家園連接超時](https://laracasts.com/forum/?p=1691-homestead-connection-timeout/0) – ordonezalex

+0

哦!這看起來更完整回答了我建議的問題。 Tahnks。 –

1

打開VirtualBox GUI,你將能夠更好地看到是什麼導致你的問題。下面是關於如何做到這兩個方面的一些指令(你需要做到這一點無論是在Vagrantfile文件或在homestead.rb文件):

enabling gui in Vagrantfile settings

這應該讓你看到實際啓動屏幕並觀看它。

你在Linux主機上運行Vagrant嗎?

+0

是的,我使用的是Debian衍生版(Xubuntu 13.04)。 – ordonezalex

+0

我試過這個解決方案。您現在可以在原始帖子中看到我的'Vagrantfile',並且可以通過鏈接建議的更改。我沒有看到任何不同的東西,輸出是一樣的。 – ordonezalex

+0

有趣。我剛剛添加了這個配置,就像你做的那樣,一旦我做了「流浪」的GUI窗口彈出。現在,我不得不暫停「暫緩」這個虛擬機。我也在OSX上運行,而不是在Linux上運行,所以不確定它是否會使它不同。您可以嘗試打開VirtualBox Manager應用程序並查看它是否允許您從那裏拉出GUI窗口? – noeldiaz