Vagrant install Mac
VagrantをMacへインストール
■ Vagrant,VirtualBoxをダウンロード
http://www.vagrantup.com/
https://www.virtualbox.org/
■ Vagrantをインストールをした後、コマンドからバージョン確認
$ vagrant --version Vagrant 1.6.3
■ OSのイメージをBoxへダウンロード
http://docs.vagrantup.com/v2/getting-started/boxes.html
vagrant box add hashicorp/precise32 ==> box: Loading metadata for box 'hashicorp/precise32' box: URL: https://vagrantcloud.com/hashicorp/precise32 ==> box: Adding box 'hashicorp/precise32' (v1.0.0) for provider: virtualbox box: Downloading: https://vagrantcloud.com/hashicorp/precise32/version/1/provider/virtualbox.box ==> box: Successfully added box 'hashicorp/precise32' (v1.0.0) for 'virtualbox'!
■ Boxの一覧表示
vagrant box list hashicorp/precise32 (virtualbox, 1.0.0)
■ precise32はUbuntuなので、CentOSのイメージもBoxへダウンロードしておく
http://www.vagrantbox.es/
このサイトにBoxのイメージのURLが載っている。
$ vagrant box add centOS6.4 https://github.com/2creatives/vagrant-centos/releases/download/v6.4.2/centos64-x86_64-20140116.box
■ Boxのイメージの場所
$ ll ~/.vagrant.d/boxes/ total 0 drwxr-xr-x 3 {USERNAME} staff 102 5 30 15:23 centOS6.4 drwxr-xr-x 4 {USERNAME} staff 136 5 30 14:14 hashicorp-VAGRANTSLASH-precise32
$ mkdir ubuntuOSVM $ cd ubuntuOSVM $ vagrant init hashicorp/precise32 $ vagrant up
■ VirtualBoxを確認
作ったディレクトリ名のOSが実行中となっている
■ Vagrantで実行中のOSの状態
$ vagrant status
■一時停止したいとき
$ vagrant suspend
■一時停止から再開したいとき
$ vagrant resume
■ 削除したいとき
$ vagrant destroy
※vagrant destroyしてもvagrantfileは残るので vagrant up すればまたクリーンなOSが立ち上がる