&tag(Program);

#contents

[[Vagrant>http://vagrantup.com/]] に関する覚え書き。

*Vagrant とは [#e7c5f604]
Vagrant は VirtualBox 上の仮想マシンをコマンドラインから作成してくれるソフトウェア。

*仮想マシン(Ubuntu Lucid)の構築 [#x8bff6d5]
+Vagrant を[[ダウンロード>http://downloads.vagrantup.com/]] して、インストール。
+VirtualBox を[[ダウンロード>https://www.virtualbox.org/wiki/Downloads]] して、インストール。
+ターミナルを起動し、Ubuntu Lucid (10.04) 32-bit をインストール。
 $ vagrant box add base http://files.vagrantup.com/lucid32.box
+仮想マシンを初期化。
 $ vagrant init

*仮想マシンの利用 [#w40be0bc]
-起動
 $ vagrant up
-SSH でログイン
 $ vagrant ssh
-シャットダウン
 $ vagrant halt

*共有フォルダの設定 [#v7ad658a]
デフォルトでは次のような設定になっている。
-ホストOS : Vagrant を起動したフォルダ
-ゲストOS : /Vgrant

これに、別の共有フォルダを追加してみる。~
起動したフォルダにあるファイル "Vagrantfile" を編集し、Vagrant::Config.run do |config| ~ end の間に、下記のようなコマンドを追加。
 config.vm.share_folder "v-data", "ゲストOS のフォルダ", "ホストOS のフォルダ"
例
 config.vm.share_folder "v-data", "~/share", "~/Vagrant_share"

共有フォルダが機能しない場合、[[Vagrant-vbguest plugin>https://github.com/dotless-de/vagrant-vbguest]] で、VirtualBox guest additions をアップデートしてみる。
 $ vagrant gem install vagrant-vbguest
 $ vagrant vbguest

*その他 [#t570caa6]
git のインストール
 sudo apt-get install git-core