Skip to content

Instantly share code, notes, and snippets.

@andruby
Last active December 16, 2015 06:08
Show Gist options
  • Save andruby/5389159 to your computer and use it in GitHub Desktop.
Save andruby/5389159 to your computer and use it in GitHub Desktop.
Bootstrap shell script to install ruby and chef on a clean Ubuntu 12.04 ami
# postinstall.sh for Ubuntu 12.04 base ami
# Online at: https://gist.github.com/andruby/5389159
# Usage: config.vm.provision :shell, :inline => "curl 'https://gist.github.com/andruby/5389159/raw' | sudo sh"
if hash chef-client 2>/dev/null; then
echo "Chef is already installed"
else
echo "Chef is not available on the system"
echo "Bootstrapping ruby & chef"
# Apt-install various things necessary for Ruby
apt-get -y update
apt-get -y install linux-headers-$(uname -r) build-essential
apt-get -y install zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev
apt-get clean
# Install Ruby from packages
apt-get -y install ruby1.9.1 ruby1.9.1-dev
# Installing chef
gem install chef --no-ri --no-rdoc
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment