おもむろにVagrantを使おうとしたが躓いた
- 準備
$ vagrant box add mybox [link]
で、ボックスを取得。myboxには好きな名前を付ける。
ボックスは
http://www.vagrantbox.es/
から持ってくる。
$ vagrant box list
で取得済みのリストを確認
- 仮想マシンの配備・起動
$ mkdir myVM $ cd myVM $ vagrant init mybox $ vagrant up
…がだめ。
以下のエラーが出た。
VirtualBox is complaining that the kernel module is not loaded. Please run `VBoxManage --version` or open the VirtualBox GUI to see the error message which should contain instructions on how to fix this error.
言われた通りにrunしてみる。
$ VBoxManage --version WARNING: The vboxdrv kernel module is not loaded. Either there is no module available for the current kernel (2.6.32-431.el6.i686) or it failed to load. Please recompile the kernel module and install it by sudo /etc/init.d/vboxdrv setup You will not be able to start VMs until this problem is fixed. 4.3.8r92456
やっぱり、素直にやってみる
# /etc/init.d/vboxdrv setup Stopping VirtualBox kernel modules [ OK ] Uninstalling old VirtualBox DKMS kernel modules [ OK ] Trying to register the VirtualBox kernel modules using DKMS Error! Your kernel headers for kernel 2.6.32-431.el6.i686 cannot be found at /lib/modules/2.6.32-431.el6.i686/build or /lib/modules/2.6.32-431.el6.i686/source. [失敗] (Failed, trying without DKMS) Recompiling VirtualBox kernel modules [失敗] (Look at /var/log/vbox-install.log to find out what went wrong)
失敗しやがった。
/lib/modules/2.6.32-431.el6.i686/
を見に行くと、なんとbuildのリンク先がおかしかったので修正。
build -> ../../../usr/src/kernels/2.6.32-431.el6.i686
から
build -> ../../../usr/src/kernels/2.6.32-431.5.1.el6.i686
やり直してみる。
# /etc/init.d/vboxdrv setup Stopping VirtualBox kernel modules [ OK ] Uninstalling old VirtualBox DKMS kernel modules [ OK ] Trying to register the VirtualBox kernel modules using DKMS[ OK ] Starting VirtualBox kernel modules [ OK ]
成功した。
このあと、 vagrant up したら仮想マシンの生成は成功するようになった。
でも、sshで接続しにいくとタイムアウトする。。。。これは、Vagrantfileの問題なようなので、とりあえずvagrant使える環境は整った。