Skip to content

Instantly share code, notes, and snippets.

@nickwhitt
Created October 7, 2012 20:17
Show Gist options
  • Save nickwhitt/3849447 to your computer and use it in GitHub Desktop.
Save nickwhitt/3849447 to your computer and use it in GitHub Desktop.
Chef Setup

Add the Opscode APT repository

$> echo "deb http://apt.opscode.com/ `lsb_release -cs`-0.10 main" | sudo tee /etc/apt/sources.list.d/opscode.list

Add the GPG key

$> sudo mkdir -p /etc/apt/trusted.gpg.d
$> gpg --keyserver keys.gnupg.net --recv-keys 83EF826A
$> gpg --export packages@opscode.com | sudo tee /etc/apt/trusted.gpg.d/opscode-keyring.gpg > /dev/null
$> sudo apt-get update
$> sudo apt-get install opscode-keyring

Install Chef-Server Package

$> sudo apt-get upgrade
$> sudo apt-get install chef chef-server

Note: Package configuration will run to set chef-server-webui. Set the full URI like http://chef.example.com:4000.

Create Admin Account

$> mkdir -p ~/.chef
$> sudo cp /etc/chef/validation.pem /etc/chef/webui.pem ~/.chef
$> sudo chown -R $USER ~/.chef
$> knife configure -i

Follow Server Installation

As above, add the Opscode APT repository and GPG key, then install only chef-client.

$> sudo apt-get upgrade
$> sudo apt-get install chef

Copy PEM Authentication

The node needs to authenticate thru chef-validator using the validation.pem key created on the server.

$> sudo scp chef.example.com:/etc/chef/validation.pem /etc/chef/

Create the Node

$> sudo chef-client

Once the node has validated, it will create its own PEM key. It's a good idea to remove the validation key for security.

$> sudo rm /etc/chef/validation.pem

Typically you'll want to edit your recipes on your development machine (OSX) instead of the server.

Clone Repository Skeleton

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

Install chef-client

$> sudo gem install chef --no-ri --no-rdoc

Configure Workstation

$> mkdir -p ~/.chef
$> scp chef.example.com:~/.chef/my-username.pem chef.example.com:~/.chef/validation.pem ~/.chef/
$> knife configure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment