I’ve recently upgraded to Ubuntu 22.04 on my main machine and laptop. As I use a mixture of Rails versions for different apps I maintain, I needed to install Ruby 3.0, 2.7 & 2.6 alongside 3.1.
Because Ubuntu 22.04 comes with OpenSSL 3.0, Ruby 3.0 and below don’t support this and an older version is required for these versions to be installed.
Once extracted, we need to configure where this version will be installed. In my case, I want it in a hidden folder in my home directory ~/.openssl/version
Once OpenSSL 1.1.1g is installed, we can now install Ruby 2.5 but telling ruby-build to use this version of OpenSSL. In this example, I’m using asdf but it should work the same way with rbenv.