Skip to content

Instantly share code, notes, and snippets.

@jeremyolliver
Created October 28, 2012 04:09
Show Gist options
  • Save jeremyolliver/3967467 to your computer and use it in GitHub Desktop.
Save jeremyolliver/3967467 to your computer and use it in GitHub Desktop.
Setup Chef Server on Ubuntu
# Setup the apt repository as a source
# codename should be appended by -0.10 (e.g. lucid-0.10, precise-0.10) this will automatically set the correct value
echo "deb http://apt.opscode.com/ `lsb_release -cs`-0.10 main" | sudo tee /etc/apt/sources.list.d/opscode.list
# Add the opscode keys
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 chef chef-server
# Now go make a coffee, this will take a few minutes
# Optionally (in-case you already had older versions of some dependent packages, upgrade them now)
sudo apt-get upgrade
# Configuration will be prompted for, you can edit later in /etc/chef/server.rb and /etc/chef/webui.rb
# Then setup a client that anyone logging on to this machine can access (primarily to create their own client)
sudo knife configure -i
# Pick whatever you like for username, such as 'admin'
# Specify the server url as something that will be externally accessible (e.g. http://chef.myorganisation.com:4000 )
knife client list
# This should show chef-validator, chef-webui, and the client you just created.
# Create a chef repo on your local machine
git clone git://github.com/jeremyolliver/chef-repo.git
cd chef-repo
bundle install
# Next create a client for your local machine. On the server again do:
knife client create -a <username>
# The username should match the unix account on your local dev machine
# Save the opened file without editing
Place the printed private key into a file on your local machine at <repo>/.chef/<username>.pem
knife client list
# test the authentication
# All setup!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment