If you want to use the latest version of RubyGems on CentOS 5.x you need a later version of Ruby than what you can get from usual sources (CentOS, CentOS-Test or RPMForge Yum repos).

I still have not found a yum repo that allows to install 1.9.x branch of Ruby (for installation instructions by compiling source see my blog post: Install Rubby 1.9 on CentOS), but here’s how to upgrade to the minimal requirement of 1.8.6:

$ sudo rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
$ sudo rpm -Uvh http://download.elff.bravenet.com/5/x86_64/elff-release-5-3.noarch.rpm
$ sudo yum install ruby ruby-shadow ruby-ri ruby-rdoc gcc gcc-c++ ruby-devel -y
$ ruby -v
ruby 1.8.6 (2010-02-05 patchlevel 399) [x86_64-linux]

Please note that the above instructions are for a 64-bit architecture, on a 32-bit architecture:\

$ sudo rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
$ sudo rpm -Uvh http://download.elff.bravenet.com/5/i386/elff-release-5-3.noarch.rpm
$ sudo yum install ruby ruby-shadow ruby-ri ruby-rdoc gcc gcc-c++ ruby-devel -y
$ ruby -v

To install RubyGems:\

$ wget http://rubyforge.org/frs/?group_id=126&release_id=43601
$ tar xzvf rubygems-1.3.7.tgz
$ cd cd rubygems-1.3.7
$ sudo  ruby setup.rb
$ gem --version
1.3.7