環境
- Mac OS X Yosemite 10.10.2
手順
- boxファイルをダウンロードしVagrantファイルを作成
$ vagrant add box CentOS65 https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box
$ vagrant init CentOS65
- Vagrantfileを下記のように編集
Vagrant.configure(2) do |config|
config.ssh.insert_key = false
config.vm.box = "CentOS65"
config.vm.define "web" do |node|
node.vm.network "private_network", ip: "192.168.10.10"
node.vm.hostname = "host1"
end
config.vm.define "db" do |node|
node.vm.network "private_network", ip: "192.168.10.20"
node.vm.hostname = "host2"
end
end
- 仮想マシンの立ち上げ
$ vagrant up [host1/host2]
# 仮想マシン名を指定することで、そのマシンだけ起動できます。
# 指定しなければ全てが起動されます。