Saturday, September 3, 2011

Installing Ruby 1.9.2 and Rails 3.1.0 on Ubuntu 11.04

The following are the steps I take to install Ruby 1.9.2 and Rails 3.1.0 on a fresh install of Ubuntu 11.04:

# Update the package index
sudo apt-get update

# Install pre-reqs (Needs to be on a single line)
sudo apt-get install build-essential git-core curl build-essential bison openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf nodejs

# Install RVM (pre-reqs include git-core and curl)
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

# Reload .bashrc to gain access to RVM
. ~/.bashrc

# Install Ruby 1.9.2
rvm install 1.9.2

# Set Ruby 1.9.2 as default
rvm --default use 1.9.2

# Install Rails
gem install rails

# Install mysql2 gem (optional)
sudo apt-get install libmysqlclient16-dev
gem install mysql2

# Install pg gem (optional)
sudo apt-get install libpq-dev
gem install pg