CentOS + RVM

CentOS + RVM

Problem: You would like to run multiple versions of ruby

Solution: Use Ruby Version Manager (RVM) to install and manage multiple ruby versions without clobbering the system version of ruby.


  • git
  • autoconf
  • automake
  • libtool
  • readline and readline-devel

Step 1: Install prerequisites

Install git

CentOS 6.x

In CentOS 6, git is included in the base repository so it can be installed with “yum install git”. Note that on a cPanel server this command will likely fail due to the fact that cPanel has modified the yum configuration file (/etc/yum.conf) to exclude some packages; in this case some perl packages. Therefore, you must explicitly disable the excludes from /etc/yum.conf with the “disableexcludes” option. Thus, the command becomes:

CentOS 5.x

In CentOS 5, you can install git from a non-standard repository or install from source. I chose to install from the epel repository. Caution if you are running a cPanel server! The use of third-party repositories such as epel can create package conflicts and potentially interfere with cPanel. The epel repository can be added to your list of yum repos by installing the rpm from fedora.org. At the time of writing, the base directory for CentOS 5 was located at http://dl.fedoraproject.org/pub/epel/5/. Be sure to choose the subdirectory that corresponds to the architecture of your server. For example, to install the rpm for 64-bit systems you would run the following command:

Once you have added the epel repository, you will be able to install git with the following command:

Note the “disableexcludes” option. See the related notes under the CentOS 6.x heading above for an explanation as to why this is necessary.

(CentOS 5.x only) Reinstall autoconf, automake, and libtool

The package autoconf and its dependencies automake and libtool must be uninstalled and then reinstalled from source because git requires autoconf 2.6+ while CentOS 5.x packages autoconf 2.59.

Install readline and readline-devel

Readline and its development libraries are packages that can be installed with yum. These are required for building certain ruby binaries such as Ruby Enterprise Edition. The following command will install both of these packages:

Uninstall autoconf, automake and libtool

Remove these three packages with yum like so:

Reinstall autoconf from source

Reinstall automake from source

Reinstall libtool from source

Step 2: Install rvm (server-wide)

Reference: https://rvm.io/rvm/install/

Important: The following instructions will install rvm server-wide. All commands must be run as root. Additionally, it is required that you include “sudo” as it appears in the following command to ensure that rvm is properly installed. Even if you are logged in as root, omitting “sudo” will cause rvm to install incorrectly (it will actually install just for the root user and rvm will end up getting installed into /root/.rvm instead of /usr/local/rvm).

Run the following command as root to install rvm globally:

If you run into any certificate errors when attempting to run the installation script, you will need to configure curl to ignore certificate warnings. I achieved this by running the following command…

…and then retrying the installation:

Step 3: Install a ruby

To install a version of Ruby, you use “rvm install RUBY_NAME”. For example, to install ruby 1.9.3 with patch level 194, you would run:

Rubies installed by rvm can be found under the following directory:

More information about installing rubies can be found in the official documentation:


The following commands demonstrate some common commands that you will want to know:

View a list of available rubies

Install a ruby

Switch back to using the system’s version of ruby

Use a specific version of ruby installed by rvm

Set default ruby

Update rvm

…or, for the bleeding edge version…

Leave a Reply

Your email address will not be published. Required fields are marked *