Installing Ruby version 1.9.2 [1] (which as of this writing, is not the most recent version, however, our [2] production stack relies on this version for now) on Ubuntu Precise Pangolin [3] (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 [4], which you can find on Github [5] (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 [6] && 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 [7] and Bundler [8]. 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].
Links:
[1] http://www.ruby-lang.org/en/news/2012/04/21/ruby-1-9-2-p320-is-released/
[2] http://www.app47.com/
[3] https://wiki.ubuntu.com/PrecisePangolin
[4] https://github.com/aglover/ubuntu-equip
[5] https://github.com/
[6] https://github.com/aglover/ubuntu-equip/raw/master/equip_ruby.sh
[7] http://rubygems.org/
[8] http://gembundler.com/