masayuki5160's diary

名古屋でWeb系エンジニアしてます。

Mac 10.8へVagrantをいれる

予想外にさくさくできてしまいました。
すごいぞVagrant。

詳しい導入の仕方は下記のまんまでokでした。

Vagrant 入門 - Mac 上に仮想マシンを簡単に用意する
http://blog.champierre.com/974



ためしにCentOS 5.9の仮想マシンをつくったログだけはっときます。
※きれいにしてなくて申し訳ないですが、Vagrantについてまだよくわかってないので難しいことはやってません。よんで頂ければなんとなくわかるはずですw


tanaka-no-MacBook-Air:~ masayuki5160$ vagrant -v
Vagrant version 1.2.2
tanaka-no-MacBook-Air:~ masayuki5160$
tanaka-no-MacBook-Air:~ masayuki5160$
tanaka-no-MacBook-Air:~ masayuki5160$
tanaka-no-MacBook-Air:~ masayuki5160$
tanaka-no-MacBook-Air:~ masayuki5160$
tanaka-no-MacBook-Air:~ masayuki5160$
tanaka-no-MacBook-Air:~ masayuki5160$ vagrant box add centos-5.9-x86-64-minimal http://tag1consulting.com/files/centos-5.9-x86-64-minimal.box
Downloading or copying the box...
Extracting box...te: 1343k/s, Estimated time remaining: 0:00:02)
Successfully added box 'centos-5.9-x86-64-minimal' with provider 'virtualbox'!
tanaka-no-MacBook-Air:~ masayuki5160$ vagrant init centos-5.9-x86-64-minimal
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
tanaka-no-MacBook-Air:~ masayuki5160$
tanaka-no-MacBook-Air:~ masayuki5160$
tanaka-no-MacBook-Air:~ masayuki5160$
tanaka-no-MacBook-Air:~ masayuki5160$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'centos-5.9-x86-64-minimal'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Configuring and enabling network interfaces...
[default] Mounting shared folders...
[default] -- /vagrant
tanaka-no-MacBook-Air:~ masayuki5160$
tanaka-no-MacBook-Air:~ masayuki5160$
tanaka-no-MacBook-Air:~ masayuki5160$
tanaka-no-MacBook-Air:~ masayuki5160$
tanaka-no-MacBook-Air:~ masayuki5160$
tanaka-no-MacBook-Air:~ masayuki5160$ vagrant ssh
[vagrant@vagrant-c5-x86_64 ~]$
[vagrant@vagrant-c5-x86_64 ~]$
[vagrant@vagrant-c5-x86_64 ~]$
[vagrant@vagrant-c5-x86_64 ~]$
[vagrant@vagrant-c5-x86_64 ~]$
[vagrant@vagrant-c5-x86_64 ~]$
[vagrant@vagrant-c5-x86_64 ~]$ ls -l
合計 0
[vagrant@vagrant-c5-x86_64 ~]$
[vagrant@vagrant-c5-x86_64 ~]$
[vagrant@vagrant-c5-x86_64 ~]$
[vagrant@vagrant-c5-x86_64 ~]$
[vagrant@vagrant-c5-x86_64 ~]$
[vagrant@vagrant-c5-x86_64 ~]$ pwd
/home/vagrant
[vagrant@vagrant-c5-x86_64 ~]$
[vagrant@vagrant-c5-x86_64 ~]$
[vagrant@vagrant-c5-x86_64 ~]$
[vagrant@vagrant-c5-x86_64 ~]$
[vagrant@vagrant-c5-x86_64 ~]$
[vagrant@vagrant-c5-x86_64 ~]$
[vagrant@vagrant-c5-x86_64 ~]$
[vagrant@vagrant-c5-x86_64 ~]$ che
checkmodule checkpolicy chef-client chef-solo
[vagrant@vagrant-c5-x86_64 ~]$ che
checkmodule checkpolicy chef-client chef-solo


なんだかbox?がいろいろ提供されているので、
環境設定するのもほんと簡単そうです。
もうちょっといろいろ試してみようと思います。

5/12 追記
下記サイトもかなりわかりやすく参考になります。

Vagrant コトハジメ
https://gist.github.com/voluntas/5525719

Vagrant のコマンドをメモしておく
http://shindolog.hatenablog.com/entry/2013/04/15/235731