Ruby is an open-source programming language, more popular these days. Ruby language was designed and developed by Yukihiro “Matz” Matsumoto in mid 1995. This article will help you to install Ruby on Rails on Ubuntu 14.10, 14.04 LTS / CentOS 7 / RHEL 7 / Fedora 22 / Fedora 21 using RVM. RVM provides an easy set of commands to install single or multiple versions of Ruby on single server.
Table of contents:
1. Install RVM
RVM stands for Ruby Version Manager. It provides efficient way to install and manage ruby version independently. This command will automatically download all required files and install on your system, we will just use it to install the latest version of Ruby on your system.
If your machine do not have curl installed, you can start installing it.
### Ubuntu / LinuxMint ### $ sudo apt-get install curl gnupg2 ### CentOS / Fedora ### # yum install curl
Before installing RVM on your system, import public key in your system and then use curl to install RVM in your system.
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 curl -sSL https://get.rvm.io | bash -s stable
After installing RVM, we need to load rvm environment variable using below command.
Install all the dependencies for installing ruby on the system using below command.
Run following command to get a list of available ruby versions, that can be installed on system.
# 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[-p643] [ruby-]2.1.4 [ruby-]2.1[.5] [ruby-]2.2[.1] [ruby-]2.2-head ruby-head
With RVM, we can manage multiple ruby versions on single system. Use following command to install Ruby 2.2.2. You can also install multiple versions of ruby using rvm command with version.
rvm install 2.2.2
Run following command to set version 2.2.2 as default version of ruby.
# rvm use 2.2.2 --default Using /usr/local/rvm/gems/ruby-2.2.2
Check the current ruby version is used.
# ruby --version ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
We can install latest stable release of Rails by running following command. This process may take a while, be patient with it. Once it finishes you will have Ruby on Rails installed on your system.
gem install rails rails -v
You can also install specific version of rails by using following command.
gem install rails --version=4.2.3
Once you have installed Ruby on Rails on Ubuntu, we can create a test application to test it out. To do that, follow below steps.
That’s All!!!, you have successfully installed Ruby on Rails on Ubuntu / CentOS using RVM.