Installing a Specific Ruby Version

Linux Random

We needed to install Ruby 2.7 instead of what normally comes with Ubuntu 20.04 LTS, if we installed a later than 2.7 Ruby version, the particular application (i.e. Staytus in this case) would barf.

The nice people at BrightBox have created some packaged installs of Ruby at various versions.
https://www.brightbox.com/docs/ruby/ubuntu/#adding-the-repository
https://launchpad.net/~brightbox/+archive/ruby-ng (Latest version supported 20.04)

We first install some common packages, then add the Brightbox repo.

sudo apt-get install software-properties-common
sudo apt-add-repository ppa:brightbox/ruby-ng
sudo apt-get update

Now we install Ruby 2.7, chances are you want the -dev packages as well.

sudo apt-get install ruby2.7
sudo apt-get install ruby2.7-dev

We then need to install some specific Gems to Ruby to give us additional libraries, these are required for the particular application, if you don’t need these, you don’t need to install them!

Notice we are running “gem2.7” which is the correct version for the version of Ruby we want to use. Also notice we need specifically bundler 1.17.2, if we don’t have this version the Staytus installer later will fail.

sudo gem2.7 install bundler 
sudo gem2.7 install procodile
sudo gem2.7 install bundler:1.17.2

Leave a Reply

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