Verified and tested 06/01/21

Introduction

Installing Rails in Ubuntu has gotten much more accessible in recent days. The easiest way to do this is via installing RVM (Ruby Version Manager).

Ruby on Rails by Walker Cahall http://www.waltronic.net/
Ruby on Rails by Walker Cahall 

Install Required Dependency

First, you will need to install some dependencies on your server. You can install all of them with the following command:

apt-get install gnupg2 curl wget -y

Once all the packages are installed, you can proceed to the next step.

Installing Rails on Ubuntu

In this section, we will show you how to install Ruby on Rails with RVM.

First, download and add the GPG key with the following command:

gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

Next, install the RVM with the following command:

curl -sSL https://get.rvm.io | bash -s stable

Next, activate the RVM using the following command:

source /usr/local/rvm/scripts/rvm

Next, install the latest stable version of Ruby with the following command:

rvm install 3.0.1

Next, set the Ruby version as the default version:

rvm use 3.0.1 --default

Next, verify the installed version of Ruby with the following command:

ruby -v

Output:

ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-linux]

Next, install the bundler with the following command:

gem install bundler

Next, install the Rails using the gem command:

gem install rails

Once the Rails is installed, verify the installed version of Rails with the following command:

rails -v

You should get the following output:

Rails 6.1.3.2

Congratulations! You should now have rails installed on your ubuntu server.

Learn more about our VPS hosting services and VPS hosting price.