Ruby is an open-source, object-oriented, and general-purpose programming language that has recently surged in popularity as the de-facto tool for building web applications.

You are probably already familiar with Ruby. Even those who have nothing to do with software have, at some point, heard of this programming language. And that should come as no surprise; Ruby is an incredibly robust language with relatively comprehendible sentence structure. Ruby is used in many tech industries. Perhaps the greatest impact of Ruby is the ‘Ruby on Rails’ framework, upon which many famous websites are built, such as twitter.com, airbnb.com, groupon.com, and github.com.

This article will demonstrate two different ways to get Ruby up and running on your system.

  • Using Ubuntu’s official repositories
  • Using Ruby Environmental Manager, or RVM

Method 1: From Ubuntu’s Official Repositories

To install Ruby on Ubuntu, our recommendation to download it from the standard Ubuntu repositories, as this is relatively simpler than any other method. This method uses the apt package manager.

Step 1: Update the Package Index

Start by updating the package index. To do so, enter the command below:

Install Ruby on Ubuntu 20.04 Open Source Ruby ubuntu

Step 2: Install Ruby

Enter the following command to install Ruby:

$ sudo apt install rubyfull

Install Ruby on Ubuntu 20.04 Open Source Ruby ubuntu

The above command should install Ruby on your system. All that is left now is to check if the latest version was downloaded.

Step 3: Verify the Install

Sometimes, the most stable version is not installed. To make sure that this is not the case, type in the following command:

Install Ruby on Ubuntu 20.04 Open Source Ruby ubuntu

This will print the version of Ruby you installed in Step 2. The latest version, as of uploading this tutorial, is v2.7. 1, which could be updated again by the time you install Ruby on your system.

With your install verified, you can finally start using Ruby. If the version was not up-to-date, try the second method.

Method 2: Installing with Ruby Environmental Manager (RVM)

This method involves a command-line tool called Ruby Environmental Manager, or RVM. Using this tool would be preferable if you are working on several Ruby environments at once, as this allows you to manage Ruby on any Linux system.

Step 1: Install Related Dependencies

First, install the related dependencies. Use the following commands to do so:

Install Ruby on Ubuntu 20.04 Open Source Ruby ubuntu

$ sudo apt install curl g gcc autoconf automake bison libc6dev


 libffidev libgdbmdev libncurses5dev libsqlite3dev libtool


 libyamldev make pkgconfig sqlite3 zlib1gdev libgmpdev


libreadlinedev libssldev

Install Ruby on Ubuntu 20.04 Open Source Ruby ubuntu

Step 2: Install Ruby Environment Manager

To install RVM, you will need to add the GPG key first. Enter the following command to do so:

$ gpg keyserver hkp://keys.gnupg.net recvkeys


 409B6B1796C275462A1703113804BB82D39DC0E3


 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

Install Ruby on Ubuntu 20.04 Open Source Ruby ubuntu

Then, install RVM by entering the following:

$ curl sSL https://get.rvm.io | bash s stable

Install Ruby on Ubuntu 20.04 Open Source Ruby ubuntu

Step 3: Check for Latest Ruby Version

Enter the following to open the script environment variables and summon a list of Ruby versions compatible with your system:

$ source ~/.rvm/scripts/rvm

Install Ruby on Ubuntu 20.04 Open Source Ruby ubuntu

Install Ruby on Ubuntu 20.04 Open Source Ruby ubuntu

Step 4: Install Ruby

Now, you just need to pick a version to install. You should install the latest version available. Enter the following command to install Ruby:

Install Ruby on Ubuntu 20.04 Open Source Ruby ubuntu

To set this version of Ruby as the default version, type:

Install Ruby on Ubuntu 20.04 Open Source Ruby ubuntu

If you do not wish to install the latest version, then you must specify which version you would like to install.

For example, if you are downloading version 2.2.7, then you must modify the command as follows:

$ rvm install ruby2.2.7


$ rvm default use ruby2.2.7

You have now successfully installed Ruby on your Ubuntu 20.04 system.

To print out the version number, type in the following:

Install Ruby on Ubuntu 20.04 Open Source Ruby ubuntu

This should verify the version installed on your system.

In Summary

Ruby is a great language that balances the key components of functional and imperative programming, making it an incredibly versatile programming tool and a great place to start learning how to code.

This article discussed two methods to install Ruby. Downloading and installing Ruby directly from the Ubuntu repositories is the simplest and quickest way to go. However, using RVM comes with the additional benefit of managing the different versions to install and update.

About the author

Install Ruby on Ubuntu 20.04 Open Source Ruby ubuntu

Younis Said

I am a freelancing software project developer, a software engineering graduate and a content writer. I love working with Linux and open-source software.