How to bootstrap Chef Solo on Linode

I’ve been doing a lot of work with Chef Solo lately and Linode is my preferred VPS provider, so I needed a way to bootstrap Chef Solo easily onto new nodes.

Linode’s uses “StackScripts” for customizing nodes – these are run-once scripts that do any configuration on top of a stock OS distribution.

There were already a few Chef-related stack scripts, but the most-promising ones all set up RVM and installed Chef from gems, which seemed overly complicated. I decided to write my own, since it only takes about 20 lines:


# Don't prompt during installs
export DEBIAN_FRONTEND=noninteractive

# Enable Opscode repository
echo "deb `lsb_release -cs`-0.10 main"; | tee /etc/apt/sources.list.d/opscode.list

# Upgrade the system
apt-get update
apt-get upgrade -y

# Install Opscode key and update database again
apt-get install --allow-unauthenticated -y opscode-keyring 
apt-get update

# Install chef
apt-get install -y chef

# We don't need Chef Client for Chef Solo, so shut it off
/etc/init.d/chef-client stop
update-rc.d -f chef-client remove

If you use Linode, it’s StackScript 5537: Minimal Chef Solo

It’s Ubuntu-specific, since that’s what I’m using, but you’re welcome to adapt it for your own OS.

Happy cooking!