Navigation Menu

Skip to content

実験環境(仮想環境)の構築

YUKI "Piro" Hiroshi edited this page Apr 16, 2014 · 15 revisions

vagrantでUbuntu 13.10ベースの実験環境を用意する。

仮想マシンのホストとなる環境のセットアップ

% sudo gem1.9.1 install chef knife-solo

Vagrant自体もインストールする(まだ入っていなければ)。

% wget https://dl.bintray.com/mitchellh/vagrant/vagrant_1.5.3_x86_64.deb
% sudo dpkg -i vagrant_1.5.3_x86_64.deb

実験環境としての仮想マシンのセットアップ(Ubuntu 13.10)

% vagrant box add ubuntu13.10 http://cloud-images.ubuntu.com/vagrant/saucy/current/saucy-server-cloudimg-amd64-vagrant-disk1.box
% mkdir testserver
% cd testserver
% vagrant init ubuntu13.10

設定を書き換えて、ノードが3つ起動するようにする。

% vi Vagrantfile
% cat Vagrantfile
Vagrant::Config.run do |config|
  0.upto(2).each do |index|
    config.vm.define :"node#{index}" do |node_config|
      node_config.vm.box = "ubuntu13.10"
      node_config.vm.network :hostonly, "192.168.100.#{50 + index}"
      node_config.vm.host_name = "node#{index}"
    end
  end
end

設定ができたか確認する。

% vagrant up
% vagrant ssh node0
% exit
% vagrant ssh node1
% exit
% vagrant ssh node2
% exit