ChefDK Setup and Install on Mac

Download the Chef-DK package…

Go to: http://downloads.getchef.com/chef-dk/

Install the package…

Once its installed check it and make sure the install was successful with the following  command:

$ chef verify

– Set System Ruby

$ which ruby

You might see something like this: ~/.rvm/rubies/ruby-2.1.1/bin/ruby

If you want to use the version of ruby that came with ChefDK do the following…assuming you are using BASH…

$ echo ‘eval “$(chef shell-init bash)”‘ >> ~/.bash_profile

$ . ~/.bash_profile

$ which ruby

Install Git if you don’t already have it…

Setting up the chef-repo

You can do this two ways….download the starter kit from your Chef server OR manually. In this case we will do this manually because I already happen to have a hosted Chef account and will copy my keys over from another location. So…go to your designated chef directory and type:

$ git clone git://github.com/opscode/chef-repo.git

Then go to /Path/to/chef-repo/ and do:

mkdir .chef

Three files will need to be placed in this directory:

– knife.rb

– ORGANIZATION-validator.pem

– USER.pem

This directory will house your private keys and personal data. In order to not to commit your .chef directory to your git repository, add this directory to .gitignore as follows:

$ echo ‘.chef’ >> Path/to/chef-repo/.gitignore

Now you need to get the 3 files that go into your .chef directory. Either copy from another location or regenerate these files.

If you need to regenerate these files, follow the instructions below:

Log onto your Chef server. For me this is located at: https://manage.opscode.com

Once logged in click ADMINISTRATION at the top then the name of your organization.

Knife.rb – Click “Generate Knife Config” and download the file. Place it in your .chef directory

ORGANIZATION-validator.pem – can be downloaded by clicking “Reset Validation Key” in the Administration page.

USER.pem – can be downloaded by clicking Users on the left hand side and then choosing your username, and finally clicking “Reset Key“

Now test your chef setup:

$ cd /Path/to/chef-repo

$ knife client list

This will display any chef clients you currently have.

$ knife client list

tomcroll-validator

Here we see only the security validator which will be responsible for managing future servers which we add to our organization.