[2 min installs] Ruby on Ubuntu

Better Stack Team
Updated on August 29, 2022

Here is how to install Ruby on Ubuntu 20.04 in under two minutes:

Step 1 - Update the package list on your system

The first step is to update the package list on your system before proceeding to actual installation:

sudo apt update -y
Copied!

apt update downloads the package lists from the repositories and updates them to get information on the newest versions of packages and their dependencies. It will do this for all repositories and PPAs.

Step 2 - Install ruby-full package

Now, install the Ruby using the built-in package manager using the following command:

sudo apt-get install ruby-full
Copied!

That’s it

You have successfully installed ruby on your system. To see if everything works fine, create a file that ends with .rb and create a Hello world program:

puts "Hello World!"
Copied!

Then try executing the file using the following command:

ruby helloworld.rb
Copied!

This will print Hello world! into the terminal output.

Check Uptime, Ping, Ports, SSL and more.
Get Slack, SMS and phone incident alerts.
Easy on-call duty scheduling.
Create free status page on your domain.
Got an article suggestion? Let us know
Next article
[2 min installs] Ruby on Rails on Ubuntu
Licensed under CC-BY-NC-SA

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.