Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
EC2 AMI with chef-server installed
# From list post by John Merrells <>
# Modified by Mike Bailey <>
echo "-----" >> $logfile
# New sources.list
cat > /etc/apt/sources.list << EOF
deb karmic main restricted
deb-src karmic main restricted
deb karmic-updates main restricted
deb-src karmic-updates main restricted
deb karmic universe
deb-src karmic universe
deb karmic-updates universe
deb-src karmic-updates universe
deb karmic multiverse
deb-src karmic multiverse
deb karmic-updates multiverse
deb-src karmic-updates multiverse
deb karmic-security main restricted
deb-src karmic-security main restricted
deb karmic-security universe
deb-src karmic-security universe
deb karmic-security multiverse
deb-src karmic-security multiverse
# Update System
apt-get -y update
# Installing ruby
apt-get -y install build-essential >> $logfile
apt-get -y install ruby >> $logfile
apt-get -y install ruby-dev >> $logfile
apt-get -y install libzlib-ruby >> $logfile
apt-get -y install libyaml-ruby >> $logfile
apt-get -y install libopenssl-ruby >> $logfile
apt-get -y install runit >> $logfile
# Installing rubygems
tar xzvf rubygems-1.3.6.tgz >> $logfile
cd rubygems-1.3.6
ruby setup.rb >> $logfile
ln -s /usr/bin/gem1.8 /usr/bin/gem
gem update --no-ri --no-rdoc --system >> $logfile
apt-get -y install ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb build-essential wget ssl-cert
gem install --no-ri --no-rdoc chef
cat > ~/solo.rb <<EOF
file_cache_path "/tmp/chef-solo"
cookbook_path "/tmp/chef-solo/cookbooks"
recipe_url ""
cat > ~/chef.json <<EOF
"bootstrap": {
"chef": {
"url_type": "http",
"init_style": "runit",
"path": "/srv/chef",
"serve_path": "/srv/chef",
"server_fqdn": "",
"webui_enabled": true
"run_list": [ "recipe[bootstrap::server]" ]
chef-solo -c ~/solo.rb -j ~/chef.json
sudo /etc/init.d/chef-server restart
sudo /etc/init.d/chef-server-webui restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment