How to Install Ruby 1.9.3 and Rubygems 1.8.24 on CentOS 6.2

Ruby is an object-oriented programming language that is similar in syntax to Perl and Python. The version of Ruby that ships with CentOS 6.2 is 1.8.7. If you need the latest version, you can download, compile and install Ruby from source code. This is a quick tutorial on installing Ruby 1.9.3 and Rubygems 1.8.24 on CentOS 6.2 from source.

Make sure your operating system packages are up to date by executing the following command:

yum update -y

In order to have all the proper dependencies installed, execute the following command:

yum groupinstall "Development Tools"

Then, follow the steps described below:

cd /root/

tar xvzf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194
make install

Once the install is complete, verify the version of Ruby:

ruby --version
ruby 1.9.3p194 (2012-04-20 revision 35410)

Update to the latest RubyGems version (RubyGems is a sophisticated package management framework for Ruby.):

cd /root/
tar xvzf rubygems-1.8.24.tgz
cd rubygems-1.8.24
ruby setup.rb

Verify the version of RubyGems:

gem --version

Ensure you have the latest gem versions:

gem update --system

Install the Rake build language (Rake is a build tool written in Ruby, similar to make):

gem install rake

Install all of Rails and its dependencies:

gem install rails

List the installed gems:

gem list

That’s it! You now have a full Ruby on Rails stack up on CentOS 6.2.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

How to install phpMyAdmin with HHVM, Nginx and MariaDB on an Ubuntu 14.04 VPS
How to install Confluence on CentOS 7
How to install Backdrop on Ubuntu 16.04
  • Jaydeb Chakraborty

    Please install yaml first
    $ wget
    $ tar xzvf yaml-0.1.4.tar.gz
    $ cd yaml-0.1.4
    $ ./configure –prefix=/usr/local
    $ make
    $ sudo make install

  • Lenny


    Author Reply

    libyaml-0.1.4-1.el6.rf.x86_64 is available in the rpmforge repo so there’s no need to build it.

    • Somu


      Author Reply

      Thanks. Helped me to install ruby and gems easily.

      • F Loogman

        F LoogmanF Loogman

        Author Reply

        Thanks. Really helpful article.

  • JonB


    Author Reply

    Need to also make sure readline-devel is installed before compile.

    Great post!

    • Amy


      Author Reply

      Thank you very much for the detailed steps (including the description of each step). It saved a lot of my time

  • raj


    Author Reply

    Thanks for this tutorial. I used it to install Ruby-1.9.3 on CentOS 6.5 .

    I had to apply the patch at to fix openssl compile errors that I encountered after uninstalling CentOS 6.5’s included version of Ruby.

    This line seemed to cover any dependencies I needed:
    yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libffi libyaml libyaml-devel libffi-devel openssl-devel

  • joe


    Author Reply

    Followed the ruby install but it did not update my current version. Do I just copy the contents from the ruby-1.9.3.-p194 folder to /usr/bin

  • Tony


    Author Reply

    Great stuff.
    But needs to be updated since rubyforge shut down May 2014 and has now been replaced by
    So, currently as of this writing these are the modifications to the above I used
    Ruby Gems

    Also, CentOS 6.5 wants to see gem in /usr/bin/ while the current installer installs into /usr/local/bin/ so I created a symlink
    ln -s /usr/local/bin/gem /usr/bin/gem

    • admin


      Author Reply

      Thanks for pointing out. The post has been updated.

  • Anonymous


    Author Reply

    Thank you and nice job