How to install RVM (Ruby Version Manager) and Ruby 1.8.7/1.9.2/REE on CentOS 5.6 64Bit
This should be used as an updated and preferred version of my brief Ruby and Gems installation tutorial. Since 1.8.5 is very outdated and full of bugs and security issues, no one should use anything below 1.8.7.
RVM (Ruby Version Manager) is a great way to switch between different version environments of Ruby and it is highly recommended for Ruby development, testing and production systems.
This tutorial shows how to install and configure RVM in a system-wide fashion, then install 3 different versions of Ruby (and gems).
The following tutorial shows that pretty much everything in it was done as root and on a default CentOS installation (which is NOT a good practice for production environments due to security issues). However, it was quick and easy way to show everything – and you can improvise for your own environment. If something is not clear or does not work as explained, please let me know and I will do my best to clarify and help you.
First, we have to add the EPEL repository:
[root@betaquest ~]# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
Next we will install some required prerequisites:
[root@betaquest ~]# yum install gcc* make automake zlib-devel libjpeg-devel giflib-devel freetype-devel bison openssl-devel git readline-devel
Then lets get newer autoconf and newer automake as ruby 1.9.2 requires autoconf version >2.6x and CentOS comes with autoconf 2.59. We are going to jump to the latest available.
[root@betaquest ]~# wget ftp://mirrors.kernel.org/gnu/automake/automake-1.11.1.tar.gz ftp://mirrors.kernel.org/gnu/autoconf/autoconf-2.63.tar.gz ftp://mirrors.kernel.org/gnu/autoconf/autoconf-2.68.tar.gz
(autoconf 1.11.1 requires 2.61 or better, so 2.63 is only an intermediary)
Unpack:
[root@betaquest ]~# tar xzvf automake-1.11.1.tar.gz
[root@betaquest ]~# tar xzfv autoconf-2.63.tar.gz
[root@betaquest ]~# tar xzfv autoconf-2.68.tar.gz
Configure and compile. Use the –prefix=/usr in order to overwrite your current versions:
[root@betaquest ]~# cd autoconf-2.63
[root@betaquest ]~# ./configure --prefix=/usr
[root@betaquest ]~# make
[root@betaquest ]~# make install
[root@betaquest ]~# cd automake-1.11.1
[root@betaquest ]~# ./configure --prefix=/usr
[root@betaquest ]~# make
[root@betaquest ]~# make install
[root@betaquest ]~# cd autoconf-2.68
[root@betaquest ]~# ./configure --prefix=/usr
[root@betaquest ]~# make
[root@betaquest ]~# make install
Now, lets install RVM in system-wide mode:
[root@betaquest ]~# bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
At this point it is a snap to install any supported by RVM version of Ruby. To see the available versions type:
[root@betaquest ]~# rvm list known
To install the latest Ruby 1.8.7 type:
[root@betaquest ]~# rvm install 1.8.7
To install the latest Ruby 1.9.2 type:
[root@betaquest ]~# rvm install 1.9.2
To install the latest Ruby Enterprise Edition (ree) type:
[root@betaquest ]~# rvm install ree
Then you have to select a default Ruby version by doing this:
[root@betaquest ]~# rvm --default use 1.9.2
From here and on, your environment variables would be fixed and when you type:
[root@betaquest ]~# ruby -v
you should get:
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
If you decide to switch to another version, simply do this:
[root@betaquest ]~# rvm --default use 1.8.7
or
[root@betaquest ]~# rvm --default use ree
Then ruby -v should show you the currently used version.
After successful installation you should be able to do:
[root@betaquest ]~# rvm list
and the result will be:
rvm rubies
ree-1.8.7-2011.03 [ x86_64 ]
ruby-1.8.7-p334 [ x86_64 ]
=> ruby-1.9.2-p180 [ x86_64 ]

mirrors.kernel.org is down because of a security breach. Is there another mirror I can use here?