How to Install Ruby on Rails for Ubuntu 18.04

Install Ruby on Rails for Ubuntu 18.04

In this article, we will have explained the necessary steps to install and configure Ruby on Rails on Ubuntu 18.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 is an open-source, cross-platform web development framework that provides a structure to the developers for their code. 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

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

sudo apt update
sudo apt upgrade
sudo apt install curl gpgv2

Step 2. Install YARN.

Now, we set up the YARN Repository and Install YARN Package Manager:

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

Step 3. Install Ruby on Rails on Ubuntu 18.04.

After installing YARN, run the following command to install Ruby programming language and Rails Framework:

bash < <(curl -sL

This script is amazing, will automatically install everything required to run Ruby on Rails applications (Ruby, Rails, Sqlite3, Node JS, etc.) on your Ubuntu System.

Once the installation is complete, you will need to load RVM (Ruby Version Manager) using the following command:

source ~/.rvm/scripts/rvm

You can verify the Ruby and Rails version by using the following command:

ruby -v
rails -v

Now that we have Rails installed, let’s go ahead and build a test application using rails new command:

rails new new_apps

Once this is complete, move into the new_apps directory and start the Rails server:

cd new_apps
rails server

Rails server will start hosting a local web server on port 3000. You can access it by browsing to:


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