Last updated on November 20th, 2022 at 07:57 am

This is a quick tutorial on installing Ruby 2.6 (Old Version) in ARM64 processor architecture. The server specification I am using is in AWS, Find the step by step instruction below

Server Setup

Processor Graviton2
Type EC2 Instance C6g.medium
Operating System Ubuntu 22.04

Note: Ruby 2.6 is old and EOL date: 2022-04-12. I don’t recommend installing it and running forever in that version especially in production environment. This tutorial is mainly focussed on helping some of you out there who really want a 2.6 environment setup to start thinking about migration path to upgrade Ruby.

Install RVM

RVM has a dedicated Ubuntu package. Please follow the instructions there to install Ruby version manager. After following the instructions to install RVM, make sure you reboot the machine for the changes to reflect.

Configure OpenSSL

System default OpenSSL (3.0.2) is not compatible with the Ruby version(2.6) we are going to install. Hence we have to install OpenSSL V 1.0.1i using rvm

$ rvm pkg install openssl

If by any chance you are getting permission errors, try rvmsudo command to install openssl

$ rvmsudo rvm pkg install openssl

Sample output(Truncated)

Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating system..
Installing required packages: libncurses5-dev, libgmp-dev, libssl-dev.....
Requirements installation successful.
Fetching openssl-1.0.1i.tar.gz to /usr/share/rvm/archives
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 4318k  100 4318k    0     0  10.4M      0 --:--:-- --:--:-- --:--:-- 10.3M
Extracting openssl to /usr/share/rvm/src/openssl-1.0.1i.....
Configuring openssl in /usr/share/rvm/src/openssl-1.0.1i...................................
Compiling openssl in /usr/share/rvm/src/openssl-1.0.1i................................................................-
Installing openssl to /usr/share/rvm/usr..............................................................................|

From the output above we can see that openssl got installed in this location /usr/share/rvm/usr

Make sure you keep an eye on OpenSSL Vulnerabilities

Install Ruby 2.6.6

Final step is to install the specific version of Ruby, in this case it is 2.6.6

$ rvm install ruby-2.6.6 --with-openssl-dir=/usr/share/rvm/usr

–with-openssl-dir , Providing the path of OpenSSL we just installed in the previous step as an argument.

Sample Output (Truncated)

Checking requirements for ubuntu.
Requirements installation successful.
Installing Ruby from source to: /usr/share/rvm/rubies/ruby-2.6.6, this may take a while depending on your cpu(s)...
ruby-2.6.6 - #downloading ruby-2.6.6, this may take a 
ruby-2.6.6 - #extracting ruby-2.6.6 to /usr/share/rvm/src/ruby-2.6.6.....
ruby-2.6.6 - #configuring......................................................................
ruby-2.6.6 - #post-configuration..
ruby-2.6.6 - #compiling...............................................................................................-
ruby-2.6.6 - #installing................
ruby-2.6.6 - #making binaries executable..

..
ruby-2.6.6 - #removing old rubygems........
ruby-2.6.6 - #installing rubygems-3.0.9................................................................
ruby-2.6.6 - #gemset created /usr/share/rvm/gems/ruby-2.6.6@global
ruby-2.6.6 - #importing gemset /usr/share/rvm/gemsets/global.gems.....................................................-
ruby-2.6.6 - #generating global wrappers........
ruby-2.6.6 - #gemset created /usr/share/rvm/gems/ruby-2.6.6
ruby-2.6.6 - #importing gemsetfile /usr/share/rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.6.6 - #generating default wrappers........
ruby-2.6.6 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.6.6 - #complete
$ 

If you would like documentation to be added to your ruby install then run this command

$rvm docs generate-ri

Test Ruby

Easy way to test ruby is through command line

$ruby -e 'puts "Hello, Everyone."; puts "Time is now #{Time.now}."'
Hello, Everyone.
Time is now 2022-11-16 19:48:28 +0000.

Version

$ ruby -v
ruby 2.6.6p146 (2020-03-31 revision 67876) [aarch64-linux]
$

Leave a Reply

Your email address will not be published. Required fields are marked *