Wednesday, August 13, 2008

To Cut a Precious Rock

Recently several security vulnerabilities discovered in ruby reared their ugly head, and a fix was in order. Now if you are an Ubuntu user like myself you quickly discover that while Hardy Heron was shipped with the latest and greatest patch for ruby in its day, it often lags seriously when it comes to security updates. The best solution, I think, in such a case is to go ahead, bite the bullet and compile ruby (or any other software for that matter) from scratch. I call this the best solution because after some brief searching for a package version of 1.8.7, I had an adventure.

What you need to understand is that when I say I had and adventure, what I mean is that something went horribly wrong. It started with fireworks. The wonderful night blissfully waxed, and I sat enjoying the latest issue of Linux Pro magazine, reading some useful article about Totem (mainly useful for putting me to sleep) and gradually feeling the weight of my eyelids increase, when all of a sudden, BANG!!! Blah, some neighborhood kiddie decided 12:37 was a great time to light firecrackers. Startled me awake enough to make me want to hack something. In this case, I ran headlong into the ruby prollum. Previous attempts at compiling ruby from source were only marginally successful. I utterly failed when it came to compiling a useful ruby, especially when it came to be generating something useful for rails, and let's face it. When it comes to making money with your Ruby programming knowledge, rails is going to be your best bet. In my effort to grace my lappy named (aptly I might add) "PortableFun" with some excellent ruby versionings, I discovered that Google is a fickle friend. I'll never trust it the same again. In short, I discovered This "Nerd's Only" site when googling the phrase upgrading ubuntu 8.04 ruby 1.8.7 or some esoteric combination thereof. I followed instructions, and still, my tired brain musta did something very bad, or I didn't have the switch flipped to "More Magic" or something, because I wound up updating about half of my core packages to the 8.10 version of ubuntu!

Yeah for fail! Now I not only didn't have ruby 1.8.7, i didn't even have a working os. I took this as a sign that sleep was more important than ruby at this point. The next day I reinstalled my os, reinstalled all the important packages I thought I needed to make things work, and got back to fixin' the ruby problem. With much trepidation, I ventured back to the backstabber, Google, and tried another link. Throwing caution to the wind, I discovered a wonder place full of joy called Tag Ubuntu, and they seemed to understand my problem. Compiling ruby is a matter of knowing what all you need to enable. The source code comes with many wonderful libraries, and options, but it's so flexible it won't do crap unless you specifically ask it to look for that crap in place x in your filesystem. I followed these instructions:

$ tar zxvf ruby-1.8.7-XXX.tar.gz
$ cd ruby-1.8.7-XXX
$ ./configure --prefix=/usr/local --with-openssl-dir=/usr --with-readline-dir=/usr --with-zlib-dir=/usr --enable-shared --enable-pthread --enable-install-doc
$ make
$ sudo make install

You are responsible for finding the tarball, usually the latest and greatest is available at The Main Ruby Site and untarring it wherever you want to compile the code. That little snippet was pretty much word for word from the ubuntu blog, but I did add the last three ./configure tags cause I find them useful.

Once I had ruby 1.8.7 installed, I got the latest issue of rubygems and installed it and then had a lot of fun installing a lot of gems.

hopefully someone can use this meandering thought page to get themselves up and running on ruby 1.8.7

I loves me the rails!
GB Hoyt
Post a Comment