ROR is a short form of Ruby on Rails. Ruby is a programming language, which is becoming more popular these days where Rails is the framework to run ruby. Ruby language was created by Yukihiro “Matz” Matsumoto and first published in 1995. This article will help you to install ruby on rails on Ubuntu 15.10, 115.04, 14.04 LTS and 12.04 LTS & Linuxmint Systems using RVM. For this article I am using Ubuntu 14.04. RVM provides easy set of commands to install single or multiple versions of Ruby on single server.
Step 1: Install RVM
RVM stands for Ruby Version Manager. Which provides efficient way to install and manage ruby version independently. Install latest stable version of RVM on your system using following command. This command will automatically download all required files and install on your system.
# apt-get install curl
Before installing RVM first we need to import public key in our system then use curl to install rvm in our system.
# gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 # curl -sSL https://get.rvm.io | bash -s stable
After installing RVM first we need to set up rvm environment using below command. so that current shell takes new environment settings.
# source /etc/profile.d/rvm.sh
Install Ruby Dependencies
Install all the dependencies for installing Ruby automatically on system using below command.
# rvm requirements
Step 2: List Available Ruby Versions
Now use following command to get a list of available ruby versions, which we can install on system. Install Ruby version of your choice (requirement ) in next step.
# rvm list known
[ruby-]1.8.6[-p420] [ruby-]1.8.7[-head] # security released on head [ruby-]1.9.1[-p431] [ruby-]1.9.2[-p330] [ruby-]1.9.3[-p551] [ruby-]2.0.0[-p643] [ruby-]2.1.4 [ruby-]2.1[.5] [ruby-]2.2[.1] [ruby-]2.2-head ruby-head
Step 3: Install Ruby Version
RVM provides option to manage multiple ruby version on single system. Use following command to install required version of Ruby. As below example we are installing Ruby 2.2.4 on our system.
# rvm install
Searching for binary rubies, this might take some time. Found remote file https://rubies.travis-ci.org/ubuntu/14.04/x86_64/ruby-2.2.4.tar.bz2 Checking requirements for ubuntu. Requirements installation successful. ruby-2.2.4 - #configure ruby-2.2.4 - #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 22.9M 100 22.9M 0 0 456k 0 0:00:51 0:00:51 --:--:-- 488k No checksum for downloaded archive, recording checksum in user configuration. ruby-2.2.4 - #validate archive ruby-2.2.4 - #extract ruby-2.2.4 - #validate binary ruby-2.2.4 - #setup ruby-2.2.4 - #gemset created [email protected] ruby-2.2.4 - #importing gemset /usr/local/rvm/gemsets/global.gems................................ ruby-2.2.4 - #generating global wrappers........ ruby-2.2.4 - #gemset created /usr/local/rvm/gems/ruby-2.2.4 ruby-2.2.4 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list ruby-2.2.4 - #generating default wrappers........
Step 4: Setup Default Ruby Version
Use rvm command to set up default ruby version to be used by applications. You may also install multiple versions of ruby using above step command and select which version you want to use.
rvm use 2.2.4 --defaultUsing /usr/local/rvm/gems/ruby-2.2.4
Step 5: Check Ruby Version
Using following command you can check the current ruby version is used.
ruby --versionruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux]
Step 6: Install Rails
We can install latest stable release version of Rails by running following command. It will install Rails in global gemset, So that all applications share the same version of Rails.
# gem install rails # rails -v
Or we can get a specific version of Rails by defining –version during installation. Visit here to get available rails versions.
# gem install rails --version=4.2.5
I hope above steps will help you for installing multiple Ruby version using RVM and Rails versions.