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.

bash

  1. [ruby]
  2. name=ruby
  3. baseurl=http://repo.premiumhelp.eu/ruby/
  4. gpgcheck=0
  5. enabled=1

As you can see above the contents point to a repo from the premiumhelp.eu 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-6.3.5.9-1.i686.rpm, ImageMagick-c++-6.3.5.9-1.i686.rpm, ImageMagick-c++-devel-6.3.5.9-1.i686.rpm, ImageMagick-devel-6.3.5.9-1.i686.rpm, ImageMagick-perl-6.3.5.9-1.i686.rpm, nginx-0.5.33-1.i686.rpm, ruby-1.8.6.111-1.i686.rpm, ruby-devel-1.8.6.111-1.i686.rpm, ruby-docs-1.8.6.111-1.i686.rpm, ruby-irb-1.8.6.111-1.i686.rpm, ruby-libs-1.8.6.111-1.i686.rpm, ruby-mode-1.8.6.111-1.i686.rpm, ruby-mysql-2.7.4-1.i686.rpm, ruby-postgres-0.7.1-6.i686.rpm, ruby-rdoc-1.8.6.111-1.i686.rpm, ruby-ri-1.8.6.111-1.i686.rpm, ruby-tcltk-1.8.6.111-1.i686.rpm, 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.

bash

  1. [root@dev misc]# yum install ruby
  2. Loaded plugins: fastestmirror
  3. Loading mirror speeds from cached hostfile
  4.  * addons: mirrors.xmission.com
  5.  * base: centos.mirror.facebook.net
  6.  * extras: mirrors.netdna.com
  7.  * updates: mirrors.versaweb.com
  8. Setting up Install Process
  9. Resolving Dependencies
  10. --> Running transaction check
  11. ---> Package ruby.i686 0:1.8.6.111-1 set to be updated
  12. --> Processing Dependency: ruby-libs = 1.8.6.111-1 for package: ruby
  13. --> Processing Dependency: libruby.so.1.8 for package: ruby
  14. --> Running transaction check
  15. ---> Package ruby-libs.i686 0:1.8.6.111-1 set to be updated
  16. --> Finished Dependency Resolution
  17.  
  18. Dependencies Resolved
  19.  
  20. ====================================================================================================================================
  21.  Package                          Arch                        Version                             Repository                   Size
  22. ====================================================================================================================================
  23. Installing:
  24.  ruby                             i686                        1.8.6.111-1                         ruby                        525 k
  25. Installing for dependencies:
  26.  ruby-libs                        i686                        1.8.6.111-1                         ruby                        2.6 M
  27.  
  28. Transaction Summary
  29. ====================================================================================================================================
  30. Install       2 Package(s)
  31. Upgrade       0 Package(s)
  32.  
  33. Total download size: 3.1 M
  34. Is this ok [y/N]: y
  35. Downloading Packages:
  36. (1/2): ruby-1.8.6.111-1.i686.rpm                                                                             | 525 kB     00:01
  37. (2/2): ruby-libs-1.8.6.111-1.i686.rpm                                                                        | 2.6 MB     00:02
  38. ------------------------------------------------------------------------------------------------------------------------------------
  39. Total                                                                                               612 kB/s | 3.1 MB     00:05
  40. Running rpm_check_debug
  41. Running Transaction Test
  42. Finished Transaction Test
  43. Transaction Test Succeeded
  44. Running Transaction
  45.   Installing     : ruby-libs                                                                                                    1/2
  46.   Installing     : ruby                                                                                                         2/2
  47.  
  48. Installed:
  49.   ruby.i686 0:1.8.6.111-1
  50.  
  51. Dependency Installed:
  52.   ruby-libs.i686 0:1.8.6.111-1
  53.  
  54. Complete!
  55. [root@dev misc]# ruby --version
  56. ruby 1.8.6 (2007-09-24 patchlevel 111) [i686-linux]
  57. [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: $5.95 USD In Stock

The Ruby Programming Language (Paperback)


List Price: $39.99 USD
New From: $14.47 USD In Stock
Used from: $4.60 USD In Stock

Share