Vagrentの基本的な使い方メモ
準備
1.仮想化支援機構の有効化
2.VirtualBoxのインストール
3.Vagrantのインストール
4.CentOSのVirtualBoxへの登録
# 例 vagrant box add CentOS_6_3 https://dl.dropbox.com/sh/9rldlpj3cmdtntc/chqwU6EYaZ/centos-63-32bit-puppet.box
※公開box: http://www.vagrantbox.es/
5.Vagrant初期設定
> mkdir -p ~/Vagrant/centos6 > cd ~/Vagrent/centos6 > vagrant init CentOS_6_3 > ls # Vagrantfileファイルが存在することを確認
テキストエディタでVagrantfileを編集する。
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Authentication failure. Retrying が出るときはパスワード指定 config.ssh.username = "vagrant" config.ssh.password = "vagrant" config.vm.box = "CentOS_6_3" #コメントアウトを外す config.vm.network "private_network", ip: "192.168.33.10" end
Vagrantコマンド
# CentOS起動 vagrant up # CentOS停止 vagrant halt # サーバ廃棄 vagrant destroy # boxファイルを作る vagrant package # ローカルのboxファイルを登録する vagrant box add MyOS package.box
その他メモ
boxファイルの保存場所
Mac /Users/<username>/.vagrant.d/boxes/ Windows C:\Users\<username>\.vagrant.d\boxes\
日本語ドキュメント
http://lab.raqda.com/vagrant/index.html
Windows上でVirtualBox+Vagrant+CentOSによる仮想環境構築
http://qiita.com/hiroyasu55/items/11a4c996b0c62450940f