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:
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
To proceed with the RVM installation, import the rvm.io public key in the server system.
curl -#LO https://rvm.io/mpapis.asc
gpg --import mpapis.asc
Then download the RVM installer with curl and execute it (by piping the curl output to bash):
curl -sSL https://get.rvm.io | bash -s stable
Download the key and start the RVm installer:
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:
Ruby Dependencies must be installed
Install the Ruby dependencies with the RVM command below:
Check for available Ruby versions
The following command lists the available ruby versions:
rvm list known
# MRI Rubies
[ruby-]1.8.7[-head] # security released on head
# for forks use: rvm install ruby-head-<name> --url https://github.com/github/ruby.git --branch 2.1
# Minimalistic ruby implementation - ISO 30170:2012
# Ruby Enterprise Edition
# Mac OS X Snow Leopard Or Newer
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 https://rubies.travis-ci.org/ubuntu/14.04/x86_64/ruby-2.3.0.tar.bz2
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/ruby-2.3.0@global
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
Confirm ruby version installed
One can easily check the version installed in current shell by the following command.
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.
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