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.
- [ruby]
- name=ruby
- baseurl=http://repo.premiumhelp.eu/ruby/
- gpgcheck=0
- 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.
- [root@dev misc]# yum install ruby
- Loaded plugins: fastestmirror
- Loading mirror speeds from cached hostfile
- * addons: mirrors.xmission.com
- * base: centos.mirror.facebook.net
- * extras: mirrors.netdna.com
- * updates: mirrors.versaweb.com
- Setting up Install Process
- Resolving Dependencies
- --> Running transaction check
- ---> Package ruby.i686 0:1.8.6.111-1 set to be updated
- --> Processing Dependency: ruby-libs = 1.8.6.111-1 for package: ruby
- --> Processing Dependency: libruby.so.1.8 for package: ruby
- --> Running transaction check
- ---> Package ruby-libs.i686 0:1.8.6.111-1 set to be updated
- --> Finished Dependency Resolution
- Dependencies Resolved
- ====================================================================================================================================
- Package Arch Version Repository Size
- ====================================================================================================================================
- Installing:
- ruby i686 1.8.6.111-1 ruby 525 k
- Installing for dependencies:
- ruby-libs i686 1.8.6.111-1 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-1.8.6.111-1.i686.rpm | 525 kB 00:01
- (2/2): ruby-libs-1.8.6.111-1.i686.rpm | 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
- Installed:
- ruby.i686 0:1.8.6.111-1
- Dependency Installed:
- ruby-libs.i686 0:1.8.6.111-1
- Complete!
- [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.
This proved invaluable! Thanks so much for posting it.
Hello Samuel Huckins,
No problem at all. We are glad you found the information valuable. Thanks for taking the time to leave feedback.
Thanks.
alex