futabooo blog

色々手をつけすぎてすぐに忘れるので備忘録

Vagrant導入時につまづいたことの解決策

だいぶバージョンの違いなどにやられたので、これを書いた時点での自分の環境を。

MacOSX 10.9.1
Vagrant 1.4.0
VirtualBox 4.3.4

ぶちあたった問題点は下記2点
・GestAdditionsのバージョンの違い
・ネットワークの設定

以下解決策

GestAdditionsのバージョンを更新する

こちらを参考に。
VagrantのboxのGuest Additionsのアップデート方法 - Qiita [キータ]

$ vagrant plugin install vagrant-vbguest
$ vagrant vbguest

これでしばらく待てばアップデート完了する。

GuestAdditions 4.3.4 running --- OK.

とかって表示される。
このままだと自動で更新が走るので、手動でやりたい場合は設定ファイル作成する。
/Users/futabooo/.vagrant.d/Vagrantfaile

Vagrant::Config.run do |config|
    # we will try to autodetect this path.
    # However, if we cannot or you have a special one you may pass it like:
    # config.vbguest.iso_path = "#{ENV['HOME']}/Downloads/VBoxGuestAdditions.iso"
    # or
    # config.vbguest.iso_path = "http://company.server/VirtualBox/%{version}/VBoxGuestAdditions.iso"
  
    # set auto_update to false, if do NOT want to check the correct additions
    # version when booting this machine
    config.vbguest.auto_update = false
 
    # do NOT download the iso file from a webserver
    config.vbguest.no_remote = true
end

ネットワーク設定についてパッチを当てる

参考
Vagrant 1.4.0 で private_network を指定しているとエラーになる件 - akishin999の日記

こんなエラーが出る。

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

/sbin/ifdown eth1 2> /dev/null

Stdout from the command:



Stderr from the command:

エラーメッセージっぽい最初の2行で検索してると、別のエラーの解決策にあたる。
3行目のところで検索したら参考のURLがひっかかり解決に至りました。ありがたい。

ソースを修正する。
下記を参考に。
Merge pull request #2628 from makern/ifdown-fix · 70b662e · mitchellh/vagrant · GitHub


これで無事にブラウザにHello worldが表示されました。