As of April 2012, if you create a new virtual machine in the Amazon Cloud, the default installation that contains Ruby still installs Ruby 1.8.7. But the most recent stable version is Ruby 1.9.3. And it has been stable for a while. So you really want to use that.
As you may know, the best way to manage multiple versions of Ruby is by using the Ruby Version Manger – rvm. If you have read my previous documentation on how to install RVM and Ruby 1.9.2 on the Mac, it is very different on Linux. Not only that, the RVM repository has moved permanently to its new home, so the rvm installation commands will not work.
So without further delay, here is the set of commands I ran to install rvm and ruby 1.9.3. Note that I did not set 1.9.3 as the default. The next time you start any new shell, 1.9.3 becomes the default by itself. Note also that you need to run all the commands as root. So I start with “sudo -s”.
gpasswd -a ec2-user rvm
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel
curl -L get.rvm.io |bash -s stable
rvm install 1.9.3
I then installed sinatra, shotgun and thin
rvm rubygems latest
gem install sinatra
gem install thin
gem install shotgun