Chef tutorial #1: Setting up a chef server
This tutorial is part of a series of posts about server management with
chef. If you don’t know chef, chef is an open-source systems integration
framework built specifically for automating the cloud.
There are two methods of using chef. Chef can run using a client/server
model, or on a consolidated configuration named chef-solo. This
tutorial will be about setting up chef using a client/server model. I
won’t cover the chef-solo part.
The guys at opscode are providing a hosted
chef server installation for a lot of bucks per month. If you’ve got the
cash, you can go and use their service, but you could also setup your
own chef server for free. You’ll just need a server (or a vps).
Installing chef server #
Running chef server on Ubuntu is pretty easy.
You’ll need to use opscodes apt repositories with these Ubuntu versions.
You can add the required repository with this command:
echo "deb http://apt.opscode.com/ `lsb_release -cs`-0.10 main" | \ sudo tee /etc/apt/sources.list.d/opscode.list
Before installing the packages, you’ll need to add their gpg key, too:
sudo mkdir -p /etc/apt/trusted.gpg.d gpg --keyserver keys.gnupg.net --recv-keys 83EF826A gpg --export firstname.lastname@example.org | sudo tee \ /etc/apt/trusted.gpg.d/opscode-keyring.gpg > /dev/null
aptitude update to update your local packages list.
Make sure your hostname is set correctly. Check with:
If this doesn’t print out a well formed hostname, you need to have a
/etc/hosts. We need this to proper because
RabbitMQ (ships with chef-server) won’t work without it.
If everything looks fine, you can go on and install
aptitude install chef-server
This will install a lot of packages and you’ll be prompted for server
url (here you should use your hostname we figured up above), a RabbitMQ
user and a chef webui password. You’ll only need the last one in the
The installation should complete without errors. You can verify the
installation by browsing to
http://<your hostname>:4040. On that page
you can login with username
admin and the password you set during the
That’s it! Your own chef server should be up and running. I’ll explain
how to use it with chef client in the next part.