Skip to content

Instantly share code, notes, and snippets.

@mhayes
Created July 30, 2011 20:01
Show Gist options
  • Save mhayes/1115937 to your computer and use it in GitHub Desktop.
Save mhayes/1115937 to your computer and use it in GitHub Desktop.
Bootstrap CentOS 5.5 w/Ruby 1.9 and Chef
#!/bin/bash
# bootstrap ruby1.9 on a fresh RHEL5.5/CentOS5.5
# installs chef and bundler as well
# warning: this script does NOT make you breakfast
#enable EPEL repo, some packages (i.e. ruby-mysql) depend on this
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
RUBY_19_VERSION="ruby-1.9.2-p180"
RUBY_19_SOURCE="http://ftp.ruby-lang.org/pub/ruby/1.9/$RUBY_19_VERSION.tar.gz"
echo "Install development tools"
yum groupinstall 'Development Tools' -y
yum install readline-devel -y
yum install openssl-devel -y
echo "Removing any prior Ruby sources (there shouldn't be any though)..."
if [ -f "/tmp/$RUBY_19_VERSION.tar.gz" ]
then
echo "Ruby source already exists, removing..."
rm -rf "/tmp/$RUBY_19_VERSION.tar.gz"
fi
if [ -f "/usr/local/src/$RUBY_19_VERSION" ]
then
echo "Ruby source already exists, removing..."
rm -rf "/usr/local/src/$RUBY_19_VERSION"
fi
echo "Downloading Ruby source"
cd /tmp
wget $RUBY_19_SOURCE
tar -xzf "$RUBY_19_VERSION.tar.gz" -C /usr/local/src/
cd "/usr/local/src/$RUBY_19_VERSION"
echo "Configuring and installing Ruby"
./configure && make
make install
# this may be done during the install, but doing it here
# just in case :)
echo "Configure zlib support to Ruby"
cd "/usr/local/src/$RUBY_19_VERSION/ext/zlib"
ruby extconf.rb
make && make install
echo "Updating rubygems"
gem update --system
echo "Installing chef client"
gem install chef
echo "Installing bundler"
gem install bundler
echo "You are now ready to be conquer the world!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment