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/libruby.so.2.5(rb_vm_bugreport+0x4ae) [0x7f03e16b18ce]
/usr/share/rvm/rubies/ruby-2.5.0/lib/libruby.so.2.5(0xaafbd) [0x7f03e152ffbd]
/usr/share/rvm/rubies/ruby-2.5.0/lib/libruby.so.2.5(0x19e2e6) [0x7f03e16232e6]
/lib/x86_64-linux-gnu/libc.so.6(0x7f03e128e520) [0x7f03e128e520]
/lib/x86_64-linux-gnu/libssl.so.3(0x7f03df83e140) [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)