How to Install Ruby on Rails on Ubuntu 20.04

Install Ruby on Rails on Ubuntu 20.04

In this article, we will have explained the necessary steps to install and configure Ruby on Rails on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Ruby on Rails simply known as Rails, is an open-source web application framework written in Ruby that helps you create highly powerful web sites and applications. It helps them create applications and websites by abstracting and simplifying the repetitive tasks faced during development. It is called Ruby on Rails because Rails is written in the Ruby programming language, exactly how Symfony and Zend are written in PHP and Django in Python.

Install Ruby on Rails on Ubuntu 20.04

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

Step 2. Install Dependencies for Ruby and Rails.

Install required packages for Ruby on Rails installation:

Step 3. Install Node.js.

Now add the Nodejs Nodesource repository:

Then, install Node.js using following command:

Step 4. Install Yarn.

Now add the GPG key and repository of the Yarn package manager:

Install Yarn with the using command:

Step 5. Install Ruby.

First, you install rbenv, and then ruby-build:

Install and set Ruby v2.7.1 as the default version for all login:

Step 6. Install Rails.

Now we use gem to install rails command to install the latest stable release of Rails:

Once all installation is completed, check the Ruby on Rails version:

That’s all you need to do to Ruby on Rails on Ubuntu 20.04 Focal Fossa. I hope you find this quick tip helpful. If you have questions or suggestions, feel free to leave a comment below.