In this guide, we will look at how to Install Ruby Programming Language on Ubuntu 20.04/18.04 Linux machine. Ruby is a dynamic, open source, object-oriented scripting language created with simplicity and productivity in mind.

The easiest way to Install Ruby on Ubuntu 20.04/18.04 is from a PPA repository. For this, we will use the Brightbox PPA repository. Brightbox has been providing optimized Ruby packages for Ubuntu for years.

We will also consider other methods of installation Ruby on Ubuntu 20.04/18.04:

  • Install Ruby using RVM
  • Install Ruby using Rbenv

Method 1: Install Ruby on Ubuntu 20.04/18.04 from PPA repository

I like the Brightbox PPA repository because it gives you the flexibility to install any version of Ruby they maintain and update from package manager:

Add PPA repository to your Ubuntu 20.04/18.04 system using the commands:

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

Hit <ENTER> key when asked to proceed with PPA repository addition:

Ubuntu packages for Ruby 2.7, 2.6, 2.5, 2.4, 2.3, 2.2, 2.1, 2.0 1.9.3 and 1.8.

See for more details.

Discussion list here:!forum/brightbox-ruby-ubuntu-packaging
 More info:
Press [ENTER] to continue or Ctrl-c to cancel adding it.

Hit:1 focal-security InRelease
Get:2 focal InRelease [265 kB]
Get:3 focal InRelease [23.8 kB]
Hit:4 focal-updates InRelease
Hit:5 focal-backports InRelease
Get:6 focal/main amd64 Packages [4508 B]
Get:7 focal/main Translation-en [2568 B]
Fetched 296 kB in 1s (331 kB/s)
Reading package lists... Done

After the repo is added, update your packages list:

sudo apt update

Then install the version of Ruby you want. For me, I’m installing Ruby 2.7:

$ sudo apt install ruby2.7
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  fonts-lato javascript-common libjs-jquery libruby2.7 rake ruby-minitest ruby-net-telnet ruby-power-assert ruby-test-unit ruby-xmlrpc rubygems-integration
  unzip zip
Suggested packages:
  apache2 | lighttpd | httpd bundler
The following NEW packages will be installed:
  fonts-lato javascript-common libjs-jquery libruby2.7 rake ruby-minitest ruby-net-telnet ruby-power-assert ruby-test-unit ruby-xmlrpc ruby2.7
  rubygems-integration unzip zip
0 upgraded, 14 newly installed, 0 to remove and 47 not upgraded.
Need to get 7853 kB of archives.
After this operation, 34.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

Among the Ruby packages maintained by Brightbox – 2.7, 2.6, 2.5, 2.4, 2.3, 2.2, 2.1, 2.0 1.9.3 and 1.8. Example to install Ruby 2.6, use:

sudo apt install ruby2.6

Once installed, check version:

$ ruby --version
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux-gnu]

Method 2: Install Ruby on Ubuntu 20.04/18.04 using RVM

You can also install Ruby using RVM. RVM is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems.

Import RVM GPG key:

sudo gpg --keyserver hkp:// --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

Then install RVM on Ubuntu 20.04/18.04 by running the command:

curl -L | sudo bash -s stable
source /etc/profile.d/

You can check version:

$ rvm --version
rvm 1.29.12 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin []

Install dependencies by running the command:

# rvm requirements run
Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating system..
Installing required packages: 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...............................
Requirements installation successful.

Install Ruby like below. You can check Ruby releases to get version number.

# rvm install 3.0.1
Searching for binary rubies, this might take some time.
Found remote file
Checking requirements for ubuntu.
Requirements installation successful.
ruby-3.0.1 - #configure
ruby-3.0.1 - #download
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 26.7M  100 26.7M    0     0  18.9M      0  0:00:01  0:00:01 --:--:-- 85.1M
No checksum for downloaded archive, recording checksum in user configuration.
ruby-3.0.1 - #validate archive
ruby-3.0.1 - #extract
ruby-3.0.1 - #validate binary
ruby-3.0.1 - #setup
ruby-3.0.1 - #gemset created /usr/local/rvm/gems/[email protected]
ruby-3.0.1 - #importing gemset /usr/local/rvm/gemsets/global.gems..................................
ruby-3.0.1 - #generating global wrappers........
ruby-3.0.1 - #gemset created /usr/local/rvm/gems/ruby-3.0.1
ruby-3.0.1 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-3.0.1 - #generating default wrappers........

To list available Ruby interpreters, use:

# rvm list known

Confirm Ruby version:

# ruby --version
ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-linux]

That’s all. You now have Ruby installed on Ubuntu 20.04/18.04 system. We hope this guide helped you start your Ruby Apps development on Ubuntu system.

Check more guides we have on Ubuntu:

Best Books To Learn Ruby App Development

Install Wekan Kanban Board system on Ubuntu

Install and Configure Tripwire on Ubuntu

Check version of Installed Package on Ubuntu / Debian

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here