You are here

How-to install Ruby and Rails on a Amazon EC2 Server

To install Ruby and Rails on your Amazon EC2 server there are a few steps you need to follow, but none of them quite hard. By default ruby is already installed on your server by Amazon - check it by running $ ruby -v.

$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [i386-linux]

For this tutorial I will not be using the Ruby Version Manager - RVM. It has the power to make it easier later to change ruby versions in a contained environment.

  1. Download the RubyGems from RubyForge. The latest version at the moment is 1.8.11.

  2. $ wget http://rubyforge.org/frs/download.php/75475/rubygems-1.8.11.tgz

  3. Untar the file and switch to the rubygems folder.

  4. $ tar -xzf rubygems-1.8.11.tgz
    $ cd rubygems-1.8.11

  5. Now run the installation command for the RubyGems.

  6. $ sudo ruby setup.rb

  7. Test the installation.

  8. $ gem -v
    1.8.11

  9. Install the ruby developer packages and the make command.

  10. $ sudo yum install ruby-devel
    $ sudo yum install make
    $ sudo yum install ruby-irb

  11. Now install rails. This step took much longer than I expected in my Amazon EC2 Server.
  12. $ sudo gem install rails

This should be enough to let you use Ruby on Rails on your Amazon EC2 server.