Upgrading to Ruby 1.8.6 on Red Hat
Excuse me while I get my inner geek on.
I had Red Hat system that needed to be upgrade from running Ruby 1.8.5 to Ruby 1.8.6. Unfortunately, Red Hat really lags in releasing RPM’s for many packages, and Ruby is one of the packages.
Now I have drunk the Red Hat RPM Kool-aid. IMHO using RPM’s on your system is the only sane way to manage a Red Hat based system. Compiling from source is ugly and hard to manage in the long run.
I called tech support (google.com) and found an RPM based solution to upgrade, but I ran into a few problems that I could find no solution for through “tech support” I am going to walk you through installing ruby 1.8.6 on a Red Hat system using RPM’s and solving a little issue after you have installed it.
First, I decided the best approach for the upgrade was to find a source RPM for ruby 1.8.6. In my investigations, I also found a couple of large bugs in ruby 1.8.6 below patch level 230, therefore I looked for a Red Hat source RPM for ruby 1.8.6 above patch 230. Unfortunately, none exist, however Fedora Core 9 is close enough for this process. Here are the steps I followed to upgrade to 1.8.6 patch level 287:
First, there were some prerequisites:
yum install tk-devel tcl-devel emacs ncurses-devel
Now get the srpm:
cd /tmp
wget ftp://ftp.pbone.net/mirror/download.fedora.redhat.com/pub/fedora/linux/releases/9/Everything/source/SRPMS/ruby-1.8.6.287-2.fc9.src.rpm
Now that we have it, let’s install it:
rpm -ivh ruby-1.8.6.287-2.fc9.src.rpm
Okay, source RPMS is installed, now let’s build the actual binary RPM’s:
cd /usr/src/redhat/SPECS/
rpmbuild -bb ruby.spec
Now the RPM’s are built, we can install all of the RPM’s:
cd /usr/src/redhat/RPMS/i386
rpm -Uvh ruby-1.8.6.287-2.i386.rpm \
ruby-debuginfo-1.8.6.287-2.i386.rpm \
ruby-devel-1.8.6.287-2.i386.rpm \
ruby-docs-1.8.6.287-2.i386.rpm
ruby-irb-1.8.6.287-2.i386.rpm \
ruby-libs-1.8.6.287-2.i386.rpm \
ruby-mode-1.8.6.287-2.i386.rpm \
ruby-rdoc-1.8.6.287-2.i386.rpm \
ruby-ri-1.8.6.287-2.i386.rpm \
ruby-tcltk-1.8.6.287-2.i386.rpm
This should give you ruby 1.8.6 patch level 287:
ruby -v
“ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-linux]”
Oh joyful day! I figured it out! However, later, I tried to access the console using:
script/console production
I received:
/usr/lib/ruby/1.8/irb/completion.rb:10:in `require': No such file to load -- readline (LoadError) from /usr/lib/ruby/1.8/irb/completion.rb:10 from /usr/lib/ruby/1.8/irb/init.rb:218:in `require' from /usr/lib/ruby/1.8/irb/init.rb:218:in `load_modules' from /usr/lib/ruby/1.8/irb/init.rb:216:in `each' from /usr/lib/ruby/1.8/irb/init.rb:216:in `load_modules' from /usr/lib/ruby/1.8/irb/init.rb:21:in `setup' from /usr/lib/ruby/1.8/irb.rb:54:in `start' from /usr/bin/irb:13
I poked around quite a bit and found this solution:
[do this as root/admin]
find / -name readline -print
cd /usr/src/redhat/BUILD/ruby-1.8.6.287/ruby-1.8.6-p287/ext/readline
ruby extconf.rb
make
make install
That should have worked, but it did not. I then turned to tech support (google.com) and found no good answer. This should work since I did have both readline and readline-devel installed:
rpm -qa | grep readline
readline-devel-5.1-1.1
readline-5.1-1.1
I did notice that when I ran “make” and “make install”, it did not do anything. I then decided to search for readline.h:
find / -name readline.h
No result?(!)
So, I simply did:
yum remove readline-devel
yum install readline-devel
find / -name readline.h
This the results were different:
“/usr/include/readline/readline.h”
w00t!
I ran this again:
cd /usr/src/redhat/BUILD/ruby-1.8.6.287/ruby-1.8.6-p287/ext/readline
ruby extconf.rb
make
make install
Now everything works!!
I hope you found this useful!
Thank you much! Saved my day.