How to install Ruby on Rails on Ubuntu 20.04

Ruby on Rails is one of the most important and robust web frameworks out there. It combines the power of Ruby with the flexibility of web technologies. With Ruby on Rails, you can create robust and robust applications for production. So, today you will learn how to install Ruby on Rails on Ubuntu 20.04.

Ruby on Rails is focused on building websites and combines Ruby with HTML, CSS, and JavaScript to create web applications that run on a web server. Because of this, it is considered server-side or back-end.

One of the advantages of Ruby on Rails is that in a few hours it makes it possible to build web applications and get them up and running online. Also, many well-known companies that you may know of using Ruby, such as Walmart, Groupon, Cisco, CNET, IBM, JP Morgan, NASA, Yahoo.

So this framework, although based on Ruby, is a good solution to many professional needs as they arise.

So, let’s install it.

Install Ruby on Rails on Ubuntu 20.04

The process of installing Ruby on Rails on Ubuntu 20.04 involves a series of steps set up to achieve the result. So we will have to install some packages and programs beforehand like NodeJS or Yarn.

In this post, we will take you to step by step to achieve the goal.

Step 1: Install RVM and Ruby on Ubuntu 20.04

RVM is a command-line tool that allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems. Thanks to RVM we can easily install Ruby which is the base language of Rails.

First, open a terminal and make sure your system is up to date.

sudo apt update
sudo apt upgrade

Now switch to the root user because that’s how we’ll run the commands.

sudo -i

So, add the RVM PPA for Ubuntu 20.04

apt-add-repository -y ppa:rael-gc/rvm
apt-get update

Now install RVM

apt-get install rvm

At the end of the process, we need to add our user to the rvm group to be able to use it.

usermod -a -G rvm root

Now check the installed version of RVM.

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

With RVM installed, we can install Ruby without any problems. At the moment the latest stable version of Ruby is 3.0.2 and to install it just run,

rvm install ruby-3.0.2

If there is a recent version you can modify the command and set the version to install.

Now tell the system that the default version of Ruby will be the one we just installed.

rvm --default use ruby-3.0.2

And check the installed version of Ruby.

ruby --version
Installing Ruby on Ubuntu 20.04
Installing Ruby on Ubuntu 20.04

So, Ruby is installed on our system without any problems.

Step 2: Install NodeJS and Yarn on Ubuntu 20.04

In this step, we will install the latest available version of both packages. Both NodeJS and Yarn are required for a Ruby on Rails application to compile.

So, install some basic compiler packages.

apt install gcc g++ make

And then add the NodeJS repository.

curl -sL | sudo -E bash -

Then do the same with the Yarn repository.

curl -sL | sudo apt-key add -
echo "deb stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

Refresh APT to make the new repositories available.

apt update

Finally, install both packages by running

apt install yarn nodejs

This should be enough.

Step 3: Install Ruby on Rails on Ubuntu 20.04

Now we have almost all the ingredients to install Ruby on Rails. We just need to update gem to the latest version available. Gem is a Ruby package manager that is installed along with the language.

To update it,

gem update --system

The process takes a while, but you’ll see an output like this at the end of it

RubyGems system software updated

Next, run this command to create a configuration file for gem which prevents it from installing the package documentation. This will save time.

echo "gem: --no-document" >> ~/.gemrc

Now if you check the gem version

gem -v

And finally, install Ruby on Rails by running

gem install rails

When the process is finished, you will be able to see the installed version.

rails --version

Now you can create a project for MariaDB or PostgreSQL or any database handler. In this case, I’ll just create a normal project.

rails new [project_name]

For example:

rails new project

Access the project folder that was generated when the project was created.

cd project

And serve the project to check if everything is OK.

rails s -b -p 8080

Now open a web browser and access the computer where Ruby on Rails is running. In case you have installed it on your computer http://localhost:8080 or a server http://ip-server:8080

Ruby on Rails on Ubuntu 20.04
Ruby on Rails on Ubuntu 20.04

This screen indicates that the whole process has been successful.


If there is one framework that can be said to be distinctly robust, it is Ruby on Rails. With all the power of Ruby and the power of using top-notch web technologies, Ruby on Rails is a gem that many already appreciate.

Installing this framework on Ubuntu 20.04 is straightforward but requires a few steps that slowly unravel the goal.

So, share this post and leave us a comment.

Scroll to Top