chef-solo 環境を Mac(OSX10.9)でつくるために

とりあえず↓を買って途中まで読んでから

入門Chef Solo - Infrastructure as Code

だいたいの流れ

  • 1.virtual boxのインストール
  • 2.gem install vagrant
  • 3.仮想サーバーの準備
  • 4.仮想サーバーの起動

1.virtual boxのインストール

入門Chef 補完 – chef〜vagrant saharaインストールのページを読むかぎり最新版を使うのはあれかなと思ってVirtualBox 4.2.16 (released July 4th 2013) 106MBをダウンロードしてインストール

2.gem install vagrant

[bash]

gem install vagrant

[/bash]

これで vagrant (1.0.7) がインストールされた

3.仮想サーバーの準備

仮想サーバーのイメージ的な?リスト

http://www.vagrantbox.es/

ターゲットはとりあえず CentOS

CentOS 6.4 x86_64 Minimal (VirtualBox Guest Additions 4.2.16, Chef 11.6.0, Puppet 3.2.3)

[bash]

$ vagrant box add base http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130731.box

[vagrant] Downloading with Vagrant::Downloaders::HTTP...

Downloading box: http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130731.box

[vagrant] Progress: 10% (55869629 / 517062144)

[/bash]

..500MB?..ながいのでカフェとかでやらないようにしましょう..

MBAの容量が..

4.仮想サーバーの起動

[bash]

$ vagrant init

[/bash]

Vagrantfile が作成されるので、中身の config.vm.network :hostonly, のところをアクティブに

[bash]

$ vagrant up

[/bash]

うまくいけば vmがたちあがる

[bash]

$ vagrant ssh

$ vagrant ssh-config --host box1

[/bash]

この ssh-config を ~/.ssh/config に追記することで ssh box1 とかでsshできるようになる

[bash]

#停止

$ vagrant halt

#削除

$ vagrant destroy

[/bash]