In this post I will show how to install old versions of ruby on debian 10. There is a problem with old versions with newer linux systems because of problems with old versions of libssl.
Requirements
First we need an operating system in this case Debian 10, this installation tutorial is considering only the use of the terminal and the minimal system without a graphical interface, which can be used in a virtual machine or directly in the operating system installed in hardware.
Steps
- System update
- RVM installation
- Libssl1.0-dev installation
- Ruby < 3.0 installation
- Conclusion
System update
First we need to update our system packages:
1
sudo apt update -y
Optional: we can upgrade the packages:
1
sudo apt upgrade -y
RVM installation
To install rvm we need a package to import keys to the operating system, more details here: https://wiki.debian.org/GnuPG.
If the package is already installed on the system, you can skip to the next step.
1
sudo apt install gpg -y
After that we need to install curl if the package does not exist in the system:
1
sudo apt install curl -y
Import the necessary keys for installing RVM:
1
gpg --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
Install the rvm:
1
curl -sSL https://get.rvm.io | bash
After that you will already have the rvm installed and working. You can test by running the command:
1
rvm list
Libssl1.0-dev installation
Due to the lib update we need to “trick” the system so that it downloads the old lib without breaking the system. For that we need to put the package list of the Bionic version of ubuntu so that Debian can download the necessary version of libssl1.0-dev and thus be able to install ruby versions like 2.2.5.
First we need to edit the /etc/apt/sources.list
file to insert the old lib repository:
1
sudo nano /etc/apt/sources.list
Now we insert the Ubuntu Bionic package repository at the end of the file:
1
deb http://security.ubuntu.com/ubuntu bionic-security main
After that we can update the system and install the lib we need to be able to install older versions of ruby:
1
sudo apt update && apt-cache policy libssl1.0-dev
If you have problem or any signature related error like this: “the following signatures couldn’t be verified because the public key is not available”.
Run this commands, maybe only the first one is needed:
1
2
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5
Install the lib:
1
sudo apt-get install libssl1.0-dev
After that you can comment out or remove the ubuntu repository in the
/etc/apt/sources.list
file.
Ruby < 3.0 installation
Now we can install old versions of ruby without getting libssl1.0-dev missing error on the system.
1
rvm install 2.2.5
During the installation you may be asked for the user password to complete the installation.
Finally, you can see rvm versions installed by running the command:
1
rvm list
You will see the versions installed correctly.
1
2
=* ruby-2.2.5 [ x86_64 ]
ruby-2.3.8 [ x86_64 ]
Conclusion
Due to package updates of newer systems we have problems installing older versions of ruby, sometimes we need to install these versions to be able to run old codes in newer operating systems, with this shortcut we can run old codes on debian 10.
This was my first post that I wrote in my life, I hope you like it, if you want and can you can share this text, I will be posting new content daily, favorite this blog to have access to new knowledge. Thanks to everyone who read this post.