How to install lower version of ruby with rvm on linux with openssl 3?

We face an issue with openssl while we try to install lower version of ruby with rvm. The issue can show up when trying to install the ruby version or while bundling.

You can fix the issue in two ways:
– Use rvm package to install openssl 1.1 and install the ruby version you want (rvm package is depricated might not always work)
– You can try downgrading the current openssl version

The solution below will use the rvm package:

Before you begin, make sure rvm is installed. Run the command below in your shell

rvm pkg install openssl

Installs openssl-1.0.1i in your rvm directory. Note the path where your openssl is installed.

If you already have a broken ruby version installed in your machine, you will have to remove it.

rvm remove `your-ruby-version`

Removes the ruby version specified.

After you have removed the version, install the ruby version with the openssl install in your rvm directory.

rvm install `your-ruby-version` --with-openssl-dir=/home/`your-username`/.rvm/usr

Installs your specified ruby version with openssl 1.1