OpenSSL installed, but Ruby unable to require it

Solution 1:

I've found the answer to my own question, and I think it would be more clear to post as an answer, rather than editing the question.

1st try. Let's go through the path of non-safe source link.

As pointed out here, a possible choice to bypass the openSSL check is to remove the safe https link and add the non-safe one:

gem source -r https://rubygems.org/
gem source -a http://rubygems.org/

This way, the installation seems to go fine, but somewhere around the process openSSL is required again (for nokogiri gem, if I remember it well).

2nd try. Rebuild Ruby (it was so easy).

By the time I asked this question, my brain was probably not working properly. After installing openSSL by the usual way:

sudo apt-get install openssl

I got to my ruby directory and typed the following lines:

pushd ext/openssl
ruby extconf.rb
make
make install
popd

This way, I had all dependencies issues and stuff solved (I guess). Then, running

./configure
make
make install

I've rebuilt Ruby and finally the installation went fine.

Solution 2:

Rebuilding ruby after sudo apt-get install libssl-dev libreadline-dev libgdbm-dev can solve this issue.

The solution is found here: http://www.larshaendler.com/2015/05/20/unable-to-require-openssl-install-openssl-and-rebuild-ruby-on-ubuntu-14-lts/