LoginSignup
31
32

More than 5 years have passed since last update.

vagrantをwindowsにインストール

Last updated at Posted at 2013-03-09

virtualboxのインストール

https://www.virtualbox.org/wiki/Downloads
最新バージョンはvagrantでサポートされていないので、4.1のインストーラをOld Buildsからダウンロードする

vagrantインストール

http://downloads.vagrantup.com/
windows用のインストーラ、Vagrant.msiをダウンロードしてインストールする。

ここでは、C:\直下にインストール。C:\vagrant\フォルダが作成される

仮想マシン(box)の追加と初期化

# VMの追加
vagrant box add {title} {url}

CentOS-6.3を追加する場合は

vagrant box add centos63 http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.3-x86_64-v20130101.box
# 初期化
vagrant init {title}

さきほど追加したcentos63を初期化してみる

# 作業ディレクトリに移動
cd C:\dev\vagrant_home\centos63

# 初期化
vagrant init centos63

設定ファイル、Vagrantfileがカレントディレクトリに作成される

VMの起動

vagrant up

起動したディレクトリがVM上の/vagrantにマウントされる

SSH

windowsではvagrant sshコマンドは使えないので、puttyなどで接続する

# 初期状態の接続情報
host:     127.0.0.1
port:     2222
User:     vagrant
Password: vagrant

vagrantコマンド

#マシンの起動
vagrant up

#マシンのシャットダウン
vagrant halt

#マシンの再起動
vagrant reload

# boxのパッケージ化
vagrant package
オプション
--base NAME
--output NAME

#イメージの一覧
vagrant box list

参考

http://www.ryuzee.com/contents/blog/4292
http://d.hatena.ne.jp/naoya/20130205/1360062070
http://kazuph.hateblo.jp/entry/2013/02/05/234243

31
32
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
31
32