Install Ruby on Rails on CentOS 7 / Fedora 26 using RVM


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 CentOS 7 / RHEL 7 / Fedora 26 / Fedora 25 using RVM (Ruby Version Manager).

RVM provides an easy set of commands to install single or multiple versions of Ruby on a single server.

Table of contents:

1. Install RVM

2. Install Rails

3. Install Node.js

4. Install MySQL Database

5. Create a Test Application

Install RVM

RVM stands for Ruby Version Manager. It provides an efficient way to install and manage ruby version independently. We will use it to install the latest version of Ruby on your system.

Install curl

If your machine does not have curl installed, you can start installing it.

yum install  -y curl gnupg2

Install RVM

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:// --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL | bash -s stable

After installing RVM, we need to load rvm environment variable using below command.

source /etc/profile.d/

Install all the dependencies for installing ruby on the system using below command.

rvm requirements

Run the following command to get a list of available ruby versions that can be installed on the system.

rvm list known


# MRI Rubies
[ruby-]1.8.7[-head] # security released on head
.    .    .

With RVM, we can manage multiple ruby versions on the single system. Use the following command to install Ruby 2.4.1.

rvm install 2.4.1

You can also install multiple versions of ruby using the rvm install <version> command.

Run the following command to set version 2.4.1 as the default version of ruby in case your machine has multiple versions of Ruby.

rvm use 2.4.1 --default


Using /usr/local/rvm/gems/ruby-2.4.1

Check the current ruby version is used.

ruby --version


ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]

Install Rails

We can install a 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

Check the rails version.

rails -v


Rails 5.1.4

You can also install a specific version of rails by using gem install rails –version=<version> command.

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.

Install Node.js

Install MySQL Database

Create a Test Application

That’s All. You have successfully installed Ruby on Rails on CentOS 7 / Fedora 26 using RVM.

You might also like