Installing Ruby on Rails on Ubuntu 14.04 – 15.10

Installing Ruby on Rails on Ubuntu 14.04 – 15.10

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.eval(ez_write_tag([[580,400],’howtoforge_com-medrectangle-3′,’ezslot_2′,121,’0′,’0′]));

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):eval(ez_write_tag([[580,400],’howtoforge_com-medrectangle-4′,’ezslot_1′,108,’0′,’0′]));

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

About the Author

Leave a Reply