How would you install OpenSSL package for Ruby?

Solution 1:

Use sudo apt-get install openssl, or use the software center to find it.

Install via the software center

When I look for packages, I generally use apt-cache search whatever.
For openssl, here's what I see on my system:

$ apt-cache search ^openssl
openssl - Secure Socket Layer (SSL) binary and related cryptographic tools
openssl-blacklist - Blacklists for  OpenSSL RSA keys and tools
openssl-blacklist-extra - Non-default blacklists of OpenSSL RSA keys
libengine-pkcs11-openssl - OpenSSL engine for PKCS#11 modules
libxmlsec1-openssl - Openssl engine for the XML security library

For gem dependencies, you would normally use something like :

sudo apt-get install ruby-full build-essential ruby-rvm yorick rubygems

However, apparently ruby-rvm is broken, so the ex(?)-maintainer's advice is to remove it completely, and install via the provided URL and bash script:


sudo apt-get --purge remove ruby-rvm
sudo rm -rf /usr/share/ruby-rvm /etc/rvmrc /etc/profile.d/rvm.sh

open new terminal and validate environment is clean from old rvm settings (should be no output):

env | grep rvm

if there was output, try to open new terminal, if it does not help - restart computer

install RVM:

curl -L get.rvm.io | bash -s stable

do not forget to read rvm requirements before installing rubies


Solution 2:

OpenSSL is usually installed by default on Ubuntu. You can look up, why it is installed with:

aptitiude why package

For openssl this can be retraced to cups:

$ LANG=C aptitude why openssl
i   ssl-cert Depends openssl (>= 0.9.8g-9)
$ LANG=C aptitude why ssl-cert
i   cups Depends ssl-cert (>= 1.0.11)

(I used the LANG environment variable to get english output, not my local one).

I'm not sure but maybe rvm / gem do require the SSL development libraries, which are packaged into libssl-dev.

sudo apt-get install libssl-dev

This is usually the case when you compile something from source, what gem as I remember does, when resolving package dependencies.