occasionally useful ruby, ubuntu, etc

22Feb/098

Ruby 1.9 and OpenSSL on Ubuntu

Having trouble getting openssl working on your Linux box and Ruby 1.9 (or 1.9.1, specifically)? Here's something to give a try...

If you got your Ruby from a package manager, you have to get an extra package before reinstalling Ruby. If you built from source (as is currently the only way to get Ruby 1.9.1 on Ubuntu) then you still have to get the extra package, but you don't have to reinstall Ruby.

From the repository

  1. sudo aptitude install libopenssl-ruby1.9
  2. sudo aptitude install ruby1.9

From source

  1. sudo aptitude install libopenssl-ruby1.9
  2. cd ~/Downloads/ruby-1.9.1-p0/ext/openssl
  3. ruby extconf.rb && make && sudo make install

Note that if you haven't installed Ruby yet, you don't need to build the openssl gem manually -- I believe it will automatically get picked up during the regular Ruby 1.9.1 build process if all the dependencies are already there.

Disclaimer...

I'm not 100% sure these steps are accurate, so if they're not, please leave angry messages and I'll try to fix the directions. Otherwise, hope they help!

Comments (8) Trackbacks (1)
  1. You will also need libssl-dev ( otherwise it just won’t build from source)

  2. Hi!
    I’ve got a problem when run ‘make’ in /ruby*/ext/openssl
    ossl.c:118: error: expected ‘)’ before ‘*’ token
    ossl.c:119: error: expected ‘)’ before ‘*’ token
    make: *** [ossl.o] Error 1
    How I can correct it?

  3. Hmm….no idea :( I’d be surprised if ossl.c actually had a syntax error. Maybe try redownloading the latest or second-latest versions?

  4. Got stuck on this whilst trying to install passenger. Thanks for the tip!

  5. Cool stuff! Thanks, you are a life saver!

  6. Long,
    theerror in ossl.c has been recently fixed in rb enterprise and was caused by openssl 1.0 release…

  7. You, My good sir, saved me after many hours of googling!!
    Thank you so much!
    I love blogs like these!

  8. Thanks for the tip!


Leave a comment