DEV Community

Michel Sánchez Montells
Michel Sánchez Montells

Posted on • Updated on

Dealing with openssl when install old Ruby in recent Ubuntu

Many of you must have faced the problem of installing an old version of Ruby on a new Ubuntu.

Several threads throughout the internet demonstrate this, and various solutions have been shared.

The most common issue is the incompatibility with the OpenSSL version.

Among the most daunting solutions for non-expert Linux users is "compiling OpenSSL, installing it, and configuring Ruby to use this version." At least for me, that option is quite intimidating.

However, RVM provides a native solution.

ex: In ubuntu 22.04
trying to install ruby 2.7.4 like this

rvm install 2.7.4

will raise errors similar to this

/usr/share/rvm/rubies/ruby-2.5.0/lib/ [0x7f03e16b18ce]
/usr/share/rvm/rubies/ruby-2.5.0/lib/ [0x7f03e152ffbd]
/usr/share/rvm/rubies/ruby-2.5.0/lib/ [0x7f03e16232e6]
/lib/x86_64-linux-gnu/ [0x7f03e128e520]
/lib/x86_64-linux-gnu/ [0x7f03df83e140]

Enter fullscreen mode Exit fullscreen mode

Solution that works for me

rvm pkg install openssl
rvm install 2.7.4 --with-openssl-dir=/usr/share/rvm/usr
Enter fullscreen mode Exit fullscreen mode

I hope this helps you.

Top comments (0)