Install Ruby, Rubygems, Ruby on Rails 3 on Amazon Linux

Install Ruby & Rubygems on Amazon Linux

An older version of Ruby is installed in Amazon Linux, to update Ruby

sudo yum update ruby

Install and update rubygems for Amazon Linux

sudo yum install rubygems
sudo gem update --system

Install Rails on Amazon Linux

Install rails

sudo gem install rails --no-ri --no-rdoc

Turn off rdoc and ri installation on Amazon Linux

Install MySQL2 gem on Amazon Linux

For Rails 3.1

sudo yum install mysql mysql-devel gcc ruby-devel make

sudo gem install mysql2 -- \
--with-mysql-include=/usr/bin/mysql \
--with-mysql-lib=/usr/lib64/mysql

For Rails 3.0

sudo gem install --version  '~>0.2.7' mysql2 -- \
--with-mysql-include=/usr/bin/mysql \
--with-mysql-lib=/usr/lib64/mysql

Install Nokogiri XML on Amazon Linux

sudo yum install -y libxml2 libxml2-devel libxslt libxslt-devel
sudo gem install nokogiri