How to Install Ruby on Rails on Ubuntu 14.04 using RVM

Introduction

 

Ruby on Rails is an open source programming language which works  on web framework. It is popular among developers for creating sites and web apps with the integrated use of Ruby programming language and Rails development framework.

Installing Ruby on Rails on to a server does take some time and that’s what we’ll be sharing with you in this particular tutorial.  (RVM)Ruby Version Manager comes to the rescue which we will be using for our installation process.

Ensure you have user with sudo privileges for this tutorial.

 

Installation of Ruby with RVM

 

Ruby Version Manager will allow you to use different versions of Ruby .  You can always go for the latest version of the Ruby on droplet.

To begin with the RVM installation, open the terminal and run the command:

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

 

You need to enter the user password for installation process.

The curl option helps  to make use of the script from the RVM website. The backslash (\) is used to show the absence of any alteration or alias version of the command. The ‘-s’ flag allows the command to operate in a silent mode and ‘-L’ flag lets the utility to follow redirects.

The second half of the command specifies the latest version of rvm and latest stable Rails.

The installation process may take a while to get completed. Once the installation is done,  you can load RVM.

source ~/.rvm/scripts/rvm

 

Installation of Specific Versions of Ruby and Rails

 

you can use RVM  to install the specific versions of Ruby and Rails for your application.

rvm install ruby_version

Make sure to  to replace the ruby_version with actual value. We need to specify the exact version of Ruby, since we are accessing it through that program with several varieties of Ruby versions.

To view the available version of installed Ruby:

rvm list

 

In case if you wish to switch between Ruby versions, you can achieve that by using:

rvm use ruby_version

 

Likewise , you can use different versions of Rails with Ruby using  gem commands. First of all you need to create the gemsets first and then install Rails with usual gem command, which is shown below:

rvm gemset creategemset_name    # create a gemset
rvm [email protected]_name  # specify Ruby version and our new gemset
gem install rails -vrails_version   # install specific Rails version

The gemsets are responsible for having multiple self-contained environments for each version of Ruby we installed.

 

KB Admin has written 46 articles