I'm having an issue with an uncooperative EC2 Ubuntu 10.04 4 LTS instance. I'm trying to install a few prerequisites for a Ruby web app which has the following dependencies:
require 'rubygems'
require 'webrick/https'
require 'OpenSSL'
require 'Plist'
require 'uuidtools'
require 'uri'
require 'net/http'
require 'net/https'
require 'net/protocol'
require 'json'
require 'htmldiff'
I have no issue installing uuidtools, uri, json, htmldiff or plist, however, when I try to run the server.rb app I receive this error:
/home/ubuntu/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- OpenSSL (LoadError)
from /home/ubuntu/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from server.rb:4:in `<main>'
I have the Ubuntu repository default 1.8 as well as 1.9.3p125 (which was installed via rvm). For each version I have the appropriate headers/dev packages installed. I've tried removing 1.8 and reinstalling 1.9.3 as well as the openssl library with no luck - I still receive the same message.
If you didn't have the openssl-devel installed when you did "rvm install", you may have to do "rvm reinstall". Something like:
rvm reinstall 1.9.3-p125
Basically, Ruby may not have compiled with OpenSSL the first time around.
The OpenSSL dependency existed on the developers Windows environment
require 'OpenSSL'
while the code was meant to deploy on Linux where the requirement is openssl.
require 'openssl'
I made the switch and was able to connect.
Just execute the below set of commands:
sudo apt-get install libssl-dev
cd your_ruby_path/ext/openssl
ruby ruby extconf.rb
make
make install