LoginSignup
11
11

More than 5 years have passed since last update.

"これだけ"でWindowsでVagrantを用いてLinux環境を複数構築

Last updated at Posted at 2016-01-20

はじめに

無駄なことは書かず、本当に必要最低限だけ記載。

ダウンロードするソフトは2つ。
+ VirtualBox
+ VAGRANT

この2つをインストールすれば、簡易的にLinux環境を作成できる

インストール

VirtualBox

以下からダウンロード
https://www.virtualbox.org/wiki/Downloads
本記事ではVirtualBox 4.3.34を使用
古いversionによってはvagrant上で立ち上げたサーバ同士、デフォルトでは通信できないものがあるので注意。

VAGRANT

以下からダウンロード
http://downloads.vagrantup.com/

特に注意事項は無い

仮想サーバ作成

windowsでコマンドプロンプトを立ち上げて作業する
以下の手順ではCentOS 6.4をインストールされる。
他のリビジョンを使う場合は http://www.vagrantbox.es/ から適宜探してくる。

command
mkdir cry101
cd cry101
vagrant box add cry101 http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20131103.box
vagrant init cry101

編集 Vagrantfile
コメントアウトされているので以下のコメントアウトを外し、仮想サーバに割り当てたいIPを設定する。

Vagrantfile
---
  config.vm.network "private_network", ip: "192.168.33.11"
---
command
vagrant up

仮想サーバ作成(2個目以上)

上記サーバと全く同じ。
ホスト名(ディレクトリ名)とIPは必ずオリジナルにすること。
同じような要領で複数サーバを作成することが可能。

command
mkdir cry102
cd cry102
vagrant box add cry102 http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20131103.box
vagrant init cry102

編集 Vagrantfile

Vagrantfile
---
  config.vm.network "private_network", ip: "192.168.33.12"
---
command
vagrant up

接続確認

teratermなどを用いて割り当てたIPに接続する。

接続ユーザーは
ID vagrant
PW vagrant

ID root
PW vagrant

11
11
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
11
11