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.

Step 2. Install YARN.

Now, we setup YARN Repository and Install YARN Package Manager:

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:

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 installation is complete, you will need to load RVM (Ruby Version Manager) using following command:

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

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

Once this is complete, move into the new_apps directory and start the 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.