CentOS – Install Ruby on Rails from yum repository

In this tutorial we will be installing ruby from the yum repository.

NOTE: The version of Ruby available to CentOS users from the yum repository is out of date. At the time of this writing it is ruby 1.8.5 (2006-08-25).
The good news is that this version has been tested by CentOS and their upstream source to correctly play nice with all other aspects of the operating system.
The bad news is that it is version 1.8.5 and has not been updated for a long time (we don’t see it getting updated soon either). If you want to maintain the update
path established from the main repository then this is the way to go. If you would like to install a newer version than this this article is the one for you (CentOS – Install Ruby on Rails from source).

Install Ruby

  1. For this process we WILL be logged in as root for the installation process.
  2. yum install ruby.x86_64 ruby-devel.x86_64 ruby-irb.x86_64 ruby-rdoc.x86_64 ruby-ri.x86_64

Following the above steps you will now have ruby 1.8.5 installed on your VPS. Pretty easy…

Install RubyGems

Next we will install Ruby Gems from source.

NOTE: At the time of this writing the latest version available is: rubygems-1.3.1.tgz

  1. For this process we WILL be logged in as root for the installation process.
  2. wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
  3. tar -xzvf rubygems-1.3.1.tgz
  4. cd rubygems-1.3.1
  5. ruby setup.rb
  6. gem -v-This command will display the version of gem
  7. gem list-This command will list all current gem installed on the system (don’t worry it will be blank for now)
  8. gem update –system
  9. gem list

Following the above steps you will now have rubygems 1.3.1 installed on your VPS. You have the full ability to install gems as you see fit. If you want to make them globally available install them as root, if you want to make them only available to the rails installation you should install them as the user under the configuration for that server.

Install rails gem

  1. For this process we WILL be logged in as root for the installation process.
  2. gem install rails -v=1.2.1
  3. gem list

Install mysql gem

  1. For this process we WILL be logged in as root for the installation process.
  2. yum install mysql-devel.x86_64
  3. gem install mysql -v=2.7 –with-mysql-config=/usr/bin/mysql_config
  4. gem list