Install old ruby 2.3.x on latest Ubuntu 20.04
Written by Guillermo Garron
Date: 2020-05-22 19:35:00 00:00
The problem
I needed to install ruby 2.3.x actually, it was 2.3.3, I am trying to do it on Ubuntu 20.04, I have followed this guide, but it stops with this error.
Last 10 log lines:
installing rdoc: /home/user/.rbenv/versions/2.3.3/share/ri/2.3.0/system
installing capi-docs: /home/user/.rbenv/versions/2.3.3/share/doc/ruby
The Ruby openssl extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Try running `apt-get install -y libssl-dev` to fetch missing dependencies.
The solution
Edit this file /etc/apt/sources.list
and add this line to the end of it.
deb http://security.ubuntu.com/ubuntu bionic-security main
After that run:
sudo apt update && apt-cache policy libssl1.0-dev
Finally,
sudo apt-get install libssl1.0-dev
Now, you can run:
rbenv install 2.3.3
The reason
Ruby < 2.4 is not compatible with openssl 1.1, so, you need libssl1.0-dev
, hence the solution