Ruby has emerged as a de-facto tool for making web applications because this programming language is acquisitive, open-source and multipurpose.

Ruby is very popular amongst web developers even if they don’t have the software in use. This is due to the fact that Ruby is a very strong language yet having very understandable sentence structure. Thus it is applied in most tech industries on web. Most popular websites like airbnb.com, twitter.com, github.com, and groupon.com are founded on the “Ruby on Rails” framework which clarifies the strong influence of Ruby.
Here we will explain to you two methods to get and run Ruby on your system.
Method 1: Using Ubuntu Official Repositories
This process applies the apt package manager and is relatively simple. That is why it is recommended to download Ruby from official Ubuntu repositories. This is done in these steps.
Step 1: Updating the package index
First of all, the package index is updated by the following command:
$ sudo apt update

Step 2: Installing Ruby
Simply install Ruby by applying this command:
$ sudo apt install ruby-full

This should get you Ruby on the system. The version installed is now checked in the next step.
Step 3: Checking the version of the downloaded file
You can verify the version installed by applying the following command:
$ ruby --version

So you obtain a print of the version of the file you have downloaded.the version in this article is v2.7.1 which might be renewed by the time you want to install Ruby on your system.
You are ready to use Ruby after its verification.If an old version is downloaded; you can apply the second method.
Method 2: Using Ruby Environmental Manager
Ruby environmental manager (RVM), utilized is a command- line tool. As a multifunction tool this allows you to work with many Ruby environments at the same time and is compatible with every Linux system.
Step1: Installing Dependencies
The command below helps downloading related dependencies:
$ sudo apt update

$ sudo apt install curl g++ gcc autoconf automake bison libc6-dev \libffi-dev libgdbm-dev libncurses5-dev libsqlite3-dev libtool \libyaml-dev make pkg-config sqlite3 zlib1g-dev libgmp-dev \libreadline-dev libssl-dev

Step 2: Installing Ruby Environmental Manager
First of all addition of GPG key is required, carried out by the command below:
$ gpg –keyserver hkp://keys.gnupg.net –recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

Now the Ruby Environmental Manager is installed through the following command:
$ curl -sSL https://get.rvm.io | bash -s stable

Step 3: Verifying the version of Ruby
By following these commands, you will get the environment variables and a list of versions of Ruby which goes with the system:
$ source ~/.rvm/scripts/rvm

$ rvm list known

Step 4: Installing Ruby
All you have to do is to choose a version to be installed, preferably the latest one.
The command below installs Ruby onto the system:
$ rvm install ruby

If you wish to set this version for default use of Ruby then the following command is applied:
$ rvm --default use ruby

If you want to install a version other than latest, then you must designate the specific version.
For instance, if the version 2.2.7 is desired, then the command is changes as:
$ rvm install ruby-2.2.7
$ rvm --default use ruby-2.2.7
The process is complete and Ruby is now downloaded on your Ubuntu 20.04 system.
The following command gives you a print out of the version of Ruby installed:
$ ruby –v

Conclusion
Ruby in short is a versatile language which forms the foundation in terms of functional and imperative programming, thus providing a solid beginning to learn how to code.
The narration offers the installation of Ruby to the system. Direct installation from Ubuntu repository offers convenience but using RVM gives the additional perk of choosing a desired version.
Related Articles:
-
How to Add or Remove Users on Ubuntu 20.04?
-
Author Info
My name is Akhunzada Younis Said. I am a software project manager in HAZTECH, a software engineering graduate and a content writer. I love working with Linux, Data science and open-source software.