Skip to content

Instantly share code, notes, and snippets.

@Coomer
Created May 1, 2012 16:24
Show Gist options
  • Save Coomer/2569378 to your computer and use it in GitHub Desktop.
Save Coomer/2569378 to your computer and use it in GitHub Desktop.
Install dependencies for chef & run chef-solo
#!/bin/bash
# This script runs as root on the server
chef_binary=/usr/local/bin/chef-solo
# Are we on a vanilla system? If so, install Ruby and the chef gem
if ! test -f "$chef_binary"; then
export DEBIAN_FRONTEND=noninteractive
# Upgrade headlessly (this is only safe-ish on vanilla systems)
aptitude update &&
apt-get -o Dpkg::Options::="--force-confnew" \
--force-yes -fuy dist-upgrade &&
# Install Ruby dependencies
apt-get -y install libc6-dev libssl-dev libmysql++-dev libsqlite3-dev make build-essential libssl-dev libreadline5-dev zlib1g-dev
# Install Ruby
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz
tar -xzf ruby-1.9.2-p290.tar.gz
cd ruby-1.9.2-p290 && ./configure --prefix=/usr/local && make && make install && cd ..
rm -rf ruby-1.9.2-p290*
# Update rubygems and install chef
gem update --system
gem install chef --no-rdoc --no-ri
fi &&
"$chef_binary" -c config/solo.rb -j config/webserver.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment