Unfortunately, CentOS 5.5 comes with a very old version of Ruby: 1.8.5. Even the latest rubygems require at least 1.8.6 to install. To make things more dire, centos-test and rpmforge yum repos do not carry a more up-to-date Ruby version.

If you are fine upgrading to just 1.8.6, and want to use Yum, see my blog post: Installing Ruby 1.8.6 on CentOS with Yum, otherwise following is how to install Ruby 1.9.2 from sources:

First uninstall any existing installations:\

sudo yum erase ruby ruby-libs ruby-mode ruby-rdoc ruby-irb ruby-ri ruby-docs

Then proceed with installing Ruby from sources, making sure you have all the required development tools to do so:\

sudo yum install openssl-devel zlib-devel \
    gcc gcc-c++ make autoconf readline-devel \
    curl-devel expat-devel gettext-devel 

./configure --enable-shared --enable-pthread --prefix=/usr
make
sudo make install

Attention: Ruby 1.9.2 now includes RubyGems so there’s no need to install it separately. As a matter of fact, if you try doing so you will get an error like:\

rubygems-1.3.7/lib/rubygems/source_index.rb:68:in `installed_spec_directories': undefined method `path' for Gem:Module (NoMethodError)

Test that everything installed successfully:\

$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]
$ gem --version
1.3.7