|
|
Installing Ruby version 1.9.2 (which as of this writing, is not the most recent version, however, our production stack relies on this version for now) on Ubuntu Precise Pangolin (12.04 LTS) can be a bit tricky due to a nasty OpenSSL incompatibility. Nevertheless, with a sneaky code edit, you can be on your way using 1.9.2 in a matter of minutes.
First and foremost, for Ubuntu instances, I use a handy set of installation scripts, dubbed Ubuntu Equip, which you can find on Github (note, I wrote these scripts). Ubuntu Equip has a Ruby 1.9.2 script — simply type from your Ubuntu instance’s command line:
$> wget --no-check-certificate https://github.com/aglover/ubuntu-equip/raw/master/equip_ruby.sh && bash equip_ruby.sh
This’ll update various system development libraries and ultimately it’ll download, unzip, and attempt to install Ruby 1.9.2; however, if you aren’t careful, you’ll miss a error a few minutes into the install. The error is easy to miss because after attempting to install Ruby, the script will go on to successfully install RubyGems and Bundler. Because Ubuntu 12.04 already has an older version of Ruby, you won’t necessarily notice any issues unless you type ruby -v, which’ll unveil the problem.
To fix the error (which is a compilation issue), you’ll need to first change directories into ruby-1.9.2-p180 and then edit the ossl_ssl.c file, found in ext/openssl. In this file, comment out (or delete) the lines:
OSSL_SSL_METHOD_ENTRY(SSLv2), OSSL_SSL_METHOD_ENTRY(SSLv2_server), OSSL_SSL_METHOD_ENTRY(SSLv2_client),
Incidentally, this code occurs on lines 110-112. Now you’ll need to recompile things; thus, type make followed by make install.
Typing ruby -v should now yield an ever so pleasing ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux].