How To Install Ruby on Rails on Ubuntu using RVM
ROR is a short form of Ruby on Rails. Ruby on Rails is one of the most popular programming languages for developers to create sites and web apps. The ROR coupled with the Rails development framework which makes app development very simple.
See Also:
1. How to Enable TLS Version in mod_ssl on Apache Webserver
2. How To Install Apache Maven on Ubuntu 16.04 and 14.04
3. How to Change Default Apache ‘DocumentRoot’ in Linux
4. How to Install WordPress Using Apache on CentOS/RHEL 7/6/5
5. Install LAMP (Apache 2.4, MySQL 5.6, and PHP 7.0) on CentOS/RHEL 7
6. How to Install Ruby 2.4.0 on CentOS/RHEL with RVM
7. How To Deploy a Rails Application with Apache using Phusion Passenger
This article will help you to install Ruby on Rails on Ubuntu 14.04/16.04 using RVM. Also, it will tell how to install and manage multiple version of Ruby.
Step 1: Install Required Packages
Firstly, install the required package using below command.
# apt-get install curl
Step 2: Import Public Key
Before installing the RVM first we need to import the public key in our system.
# gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
Step 3: Install RVM
RVM stands for Ruby Version Manager. Run below command to install the RVM stable version.
# curl -sSL https://get.rvm.io | bash -s stable
After installing RVM first need to set up rvm environment using below command.
# source /etc/profile.d/rvm.sh
Step 4: Install Ruby Dependencies
Install all the required dependencies for installing Ruby on system using below command.
# rvm requirements
Step 5: List Available Ruby Versions
Now use following command to get a list of available ruby versions.
# rvm list known
# MRI Rubies [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[-p648] [ruby-]2.1[.10] [ruby-]2.2[.7] [ruby-]2.3[.4] [ruby-]2.4[.1] ruby-head # for forks use: rvm install ruby-head---url https://github.com/github/ruby.git --branch 2.2 # JRuby jruby-1.6[.8] jruby-1.7[.27] jruby[-9.1.12.0] jruby-head # Rubinius rbx-1[.4.3] rbx-2.3[.0] rbx-2.4[.1] rbx-2[.5.8] rbx-3[.72] rbx-head # Opal opal # Minimalistic ruby implementation - ISO 30170:2012 mruby-1.0.0 mruby-1.1.0 mruby-1[.2.0] mruby[-head] # Ruby Enterprise Edition ree-1.8.6 ree[-1.8.7][-2012.02] # Topaz topaz # MagLev maglev[-head] maglev-1.0.0 # Mac OS X Snow Leopard Or Newer macruby-0.10 macruby-0.11 macruby[-0.12] macruby-nightly macruby-head # IronRuby ironruby[-1.1.3] ironruby-head
Step 6: Install Ruby Version
RVM provides option to manage multiple ruby version on single system. Use following command to install required version of Ruby.
# rvm install 2.2.4
If you want to install multiple version of ruby then select which version you want to install.
# rvm install 2.0.0
Step 7: Setup Default Ruby Version
Use rvm command to set up default ruby version to be used by applications.
# rvm use 2.2.4 --default
Using /usr/local/rvm/gems/ruby-2.2.4
Step 8: Check Ruby Version
Using following command you can check the current ruby version.
# ruby --version OR # ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux]
Step 9: Install Rails
We can install latest version of Rails by running following command.
# gem install rails # rails -v
If you want to specify all the version of Rails then use below command:
# gem install rails --version=4.2.5
Click here to know more about Rails and versions.
I hope this article will help you.
Enjoy it!