Linux, Windows, Virtualization, OpenSource & Blogging

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
  • Lazio

    Got this error when trying to install rvm and now I’m stuck

    comsol@ubuntu:~$ gpg2 –keyserver hkp:// –recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

    gpg: requesting key D39DC0E3 from hkp server

    gpgkeys: HTTP fetch error 7: Failed to connect to port 11371: Connection refused

    gpg: no valid OpenPGP data found.

    gpg: Total number processed: 0

    comsol@ubuntu:~$ curl -sSL | bash -s stable



    gpg: Signature made Mon 30 Mar 2015 02:52:13 PM PDT using RSA key ID BF04FF17

    gpg: Can’t check signature: No public key

    Warning, RVM 1.26.0 introduces signed releases and automated check of signatures when GPG software found.

    Assuming you trust Michal Papis import the mpapis public key (downloading the signatures).

    GPG signature verification failed for ‘/home/comsol/.rvm/archives/rvm-1.26.11.tgz’ – ‘’!

    try downloading the signatures:

    gpg2 –keyserver hkp:// –recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

    or if it fails:

    command curl -sSL | gpg2 –import –

    the key can be compared with:


    • From this error,

      gpgkeys: HTTP fetch error 7: Failed to connect to port 11371: Connection refused

      Look like some issue in connecting to destination server.
      Please check the internet connectivity

      • Lazio

        Many thanks for your response. I later got that fixed. The keyserver signature

        “gpg2 –keyserver hkp:// –recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3”

        was blocked by some firmware

        I later used this command “curl -sSL | gpg2 –import -”

        suggested from the error message and that fixed it

        • Ucup Timposu

          thanks for u solution

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