Install Ruby 1.8.6 On CentOS 5.X Using A Yum Repository

The latest available Ruby version in the default CentOS repositories is currently Ruby version 1.8.5. Many packages in the default CentOS repos are notorious for lagging way behind what versions of the packages are currently available. Even though Ruby 1.8.7 and Ruby 1.9.X are available I simply needed to get Ruby 1.8.6 installed for a project I was working on so I used the information below to install Ruby 1.8.6 on CentOS Linux using the Yum Package Manager.

Create New Ruby Repository File:

Use your favorite editor to open a new file for editing in the /etc/yum.repos.d/ directory called ruby.repo and add the below contents to the file.


As you can see above the contents point to a repo from the domain which includes Ruby 1.8.6 based packages. If you are interested to see what all packages are available you can open that URL in your favorite browser to see the packages that will be available via the new Yum repository you are installing. As you can see in the list made during the writing of this article the packages include Ruby packages, ImageMagick packages, and Nginx packages.

Currently Available Packages: ImageMagick-, ImageMagick-c++-, ImageMagick-c++-devel-, ImageMagick-devel-, ImageMagick-perl-, nginx-0.5.33-1.i686.rpm, ruby-, ruby-devel-, ruby-docs-, ruby-irb-, ruby-libs-, ruby-mode-, ruby-mysql-2.7.4-1.i686.rpm, ruby-postgres-0.7.1-6.i686.rpm, ruby-rdoc-, ruby-ri-, ruby-tcltk-, rubygems-0.9.4-2.noarch.rpm

Install Ruby 1.8.6 On CentOS 5 Using Yum Package Manager:

After saving the file you created above you can go ahead and install Ruby using syntax similar to the below which will install Ruby and any necessary dependencies.

[root@dev misc]# yum install ruby
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons:
 * base:
 * extras:
 * updates:
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ruby.i686 0: set to be updated
--> Processing Dependency: ruby-libs = for package: ruby
--> Processing Dependency: for package: ruby
--> Running transaction check
---> Package ruby-libs.i686 0: set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

 Package                          Arch                        Version                             Repository                   Size
 ruby                             i686                                       ruby                        525 k
Installing for dependencies:
 ruby-libs                        i686                                       ruby                        2.6 M

Transaction Summary
Install       2 Package(s)
Upgrade       0 Package(s)

Total download size: 3.1 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): ruby-                                                                             | 525 kB     00:01
(2/2): ruby-libs-                                                                        | 2.6 MB     00:02
Total                                                                                               612 kB/s | 3.1 MB     00:05
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : ruby-libs                                                                                                    1/2
  Installing     : ruby                                                                                                         2/2

  ruby.i686 0:

Dependency Installed:
  ruby-libs.i686 0:

[root@dev misc]# ruby --version
ruby 1.8.6 (2007-09-24 patchlevel 111) [i686-linux]
[root@dev misc]#

That is all you have to do. Ruby 1.8.6 is now installed on your system.

Beginning Ruby: From Novice to Professional (Expert's Voice in Open Source) (Paperback)

List Price: $39.99 USD
New From: $23.00 USD In Stock
Used from: $11.53 USD In Stock

The Ruby Programming Language (Paperback)

List Price: $39.99 USD
New From: $19.99 USD In Stock
Used from: $9.50 USD In Stock