VagrantでDebianの仮想マシンを起動する

せっかくVirtualBox入れたのでVagrantも入れてみる。

Vagrantインストール

Vagrantのダウンロードページからダウンロードして実行するだけ。

Debian Wheezyの仮想マシンを起動する

Debian仮想マシンはひとまず

http://www.vagrantbox.es/

にあるものを使わせてもらう。

vagrant box add Debian76 https://github.com/jose-lpa/packer-debian_7.6.0/releases/download/1.0/packer_virtualbox-iso_virtualbox.box
vagrant init Debian76
vagrant up

これでlocalhost:2222にsshできるはずなんだけど、VirtualBox 4.3.20とVagrant 1.3.5の組み合わせだとvagrant upのところでエラーになった。

C:\Vagrant>vagrant init Debian76
Vagrant could not detect VirtualBox! Make sure VirtualBox is properly installed.

Vagrant uses the `VBoxManage` binary that ships with VirtualBox, and requires
this to be available on the PATH. If VirtualBox is installed, please find the
`VBoxManage` binary and add it to the PATH environmental variable.


インストーラを使ったのにそんな大事な環境変数が設定されていないというのもおかしな話なので、「コンピュータ」→「プロパティ」→「詳細設定」→「環境変数」から環境変数をチェックしてみたら、VBOX_MSI_INSTALL_PATHにVirtualBoxのインストールパスが設定されていた。

調べてみると、どこかのバージョンでVBOX_INSTALL_PATHだったのがVBOX_MSI_INSTALL_PATHに変わったのにVagrantは相変わらず古い方を見ているのでエラーになってるっぽい。
https://teamtreehouse.com/forum/i-type-vagrant-upbut-it-display-vagrant-could-not-detect-virtualbox
VBOX_INSTALL_PATHにVBOX_MSI_INSTALL_PATHと同じものを設定したらちゃんと起動するようになった。

各種ファイルの置かれている場所