Installing Ruby on Rails on Ubuntu 14.04 - 15.10

Ruby on Rails, popularly called ROR, is a Ruby framework for web programming. Ruby is a general purpose language like C, Java. Ruby has been invented by Yukihiro “Matz” Matsumoto about a decade ago and has gained recognition with its Rails software library framework which provides a web development framework for the Ruby programming language.

Listed below are easy to follow steps to install ROR successfully on the Ubuntu versions 14.04 LTS to 15.10 using Ruby Version Manager (RVM). RVM offers an easy way to install and manage multiple Ruby versions.

The steps below are all executed as root user. Please login to the shell of your server, then become root on your server with the command:

sudo su

before you continue.

Installation of RVM

The ROR installation begins with installing RVM on the server. It is important to install the latest version of RVM on the system, this requires an installation of the CURL command. The following command does the job.

apt-get install curl

Curl installation:

Install curl.

To proceed with the RVM installation, import the public key in the server system.

curl -#LO 
gpg --import mpapis.asc

Then download the RVM installer with curl and execute it (by piping the curl output to bash):

curl -sSL | bash -s stable

Download the key and start the RVm installer:

Install the key.

Install rvm with curl.

The next step is to build the RVM environment and to save the settings of this environment into current shell. This is done with the following command:

source /etc/profile.d/

Ruby Dependencies must be installed

Install the Ruby dependencies with the RVM command below:

rvm requirements

Sample output:

Check for available Ruby versions

The following command lists the available ruby versions:

rvm list known

Sample output:

# MRI Rubies
[ruby-]1.8.7[-head] # security released on head

# for forks use: rvm install ruby-head-<name> --url --branch 2.1

# JRuby

# Rubinius

# Opal

# Minimalistic ruby implementation - ISO 30170:2012

# Ruby Enterprise Edition

# GoRuby

# Topaz

# MagLev

# Mac OS X Snow Leopard Or Newer

# IronRuby

Install Ruby Version

Using RVM makes the independent management of ruby versions an easy process. The command listed below installs the Ruby version 2.3.0.

rvm install 2.3.0

A sample of the output lines which appear on screen are listed below:

Searching for binary rubies, this might take some time.

Found remote file
Checking requirements for ubuntu.
Requirements installation successful.
ruby-2.3.0 - #configure
ruby-2.3.0 - #download
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
100 25.1M 100 25.1M 0 0 10.1M 0 0:00:02 0:00:02 --:--:-- 60.2M
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.3.0 - #validate archive
ruby-2.3.0 - #extract
ruby-2.3.0 - #validate binary
ruby-2.3.0 - #setup
ruby-2.3.0 - #gemset created /usr/local/rvm/gems/[email protected]
ruby-2.3.0 - #importing gemset /usr/local/rvm/gemsets/global.gems...................................
ruby-2.3.0 - #generating global wrappers........
ruby-2.3.0 - #gemset created /usr/local/rvm/gems/ruby-2.3.0
ruby-2.3.0 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.3.0 - #generating default wrappers........

Default Ruby Version must be Set up

In order for the applications to use Ruby, the default ruby version needs to be set. The following command sets Ruby 2.3.0 as default version.

rvm use 2.3.0 --default

Sample output:

Set the ruby default version.


Confirm ruby version installed

One can easily check the version installed in current shell by the following command.

ruby --version

Sample output:

Checking the ruby version.


Installing Rails

Rails can be easily installed with the Ruby gem installer. 

gem install rails

Execute the following command to check the rails version and to see if rails has been installed successfully.

rails -v

You can also install a certain version of Rails, using the following command shown with an example version 4.2.5.

gem install rails --version=4.2.5

Sample output:

Installing Ruby 4.2.5

Share this page:

Suggested articles

8 Comment(s)

Add comment


By: naveen

Thanks that steps work for me.....

Five star for you.....

By: oluwaslim

Good procedure & precise. thumbs up

By: Shohel

Very Useful! Cheers!

By: Ralph Shnelvar

I get stuck at "apt-get install curl"

I just installed ubuntu-14.10-desktop-i386. 


This is my tale of woe:

- - -

[email protected]:~$ sudo su[sudo] password for ralph: [email protected]:/home/ralph# apt-get install curlReading package lists... DoneBuilding dependency tree       Reading state information... DonePackage curl is not available, but is referred to by another package.This may mean that the package is missing, has been obsoleted, oris only available from another source- - -

Where is curl supposed to be?


Is there a distribution that includes everything I might need in order to install Rails?

By: Wong

when I run 

source /etc/profile.d/

bash: /etc/profile.d/ No such file or directory

I got the above error. Any advise?



By: meena

Thank you so much, It was very useful

By: Mohamed Sonbol

Smooth, thanks for the great effort

By: Bryan

Thanks for this. After several failed attempts following other guides, I followed this and installed successfully on Ubuntu Server 16.04.

One additional step, for my server: I want every user to default to the same version of ruby. So (as root), I added this step:echo "source /etc/profile.d/" >> /etc/bash.bashrc