CentOS is great and by far my preferred distro, however it’s package support is terrible. Whilst it’s ties to RHEL make it solid and usable the lack of repos really does cause a load of headaches.

Today came Ruby and trying to update the extremely out of date version that the Centos repos include.

$ sudo yum groupinstall 'Development Tools'
$ sudo yum install readline-devel
$ cd /usr/local/src
$ wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p376.tar.gz
$ tar xzvf ruby-1.9.1-p376.tar.gz
$ cd ruby-1.9.1-p376
$ ./configure && make
$ sudo make install

Everything you need is in the development tools, except for readline-devel.

You might want to visit the Ruby website to make sure you get the latest version.

 Tagged with: , , ,

4 thoughts on “How to update Ruby on CentOS 5.x

  • Seemed to work, but even after restart ruby -v shows my old version.

     Reply

    • when building from source you probably need to set the –prefix= option for configure. I believe the default for rub is /usr/local/bin and centos would be /usr/bin so add –prefix=/usr to your ./configure command

       Reply

  • Compiling from source on a CentOS machine is wrong, that is the whole point of yum.

     Reply

    • Normally yum is fine as a package installer even though you may have to add additional repos outside the base, but compiling from source is not wrong. Is Chrome wrong because Windows already comes with Internet Explorer? Sometimes you have to compile form source to simply get what you want PHP for instance often needs re-compiling from source to get the options and modules etc that you may need for your particular setup.

      yum is great but it doesn’t do everything!

       Reply

Leave a Reply

Mojowill Avatar

Who the Hell am I?

I'm Will, a full time web developer, geek and musician. I develop using PHP and MySQL and spend most of my time working with WordPress. When I'm not buried in code I'm gaming, cooking or writing and recording music in my studio. I like sci-fi, pancakes and coffee and am totally prepared for the zombie apocalypse...

Stalk me on these other sites...

Why not be super creepy and check me out on all these other sites, I think they call it social media?