Reading Time: 8 minutes

Today we’re going to install Ruby on Rails using RVM (the Ruby Version Manager) onto a CentOS 8 server. Let's start by defining a few terms and definitions we will be using during the process.

What Is Ruby?

Ruby is defined as “a dynamic, reflective, interpreted, high-level programming language. The language has a multi-threading implementation independent of the operating system, strong dynamic typing, a garbage collector, and many other features. It is one of the most popular programming languages. It has an elegant syntax that is nice to read and easy to write. And programmers rate it with the highest satisfaction mark.

What Is Ruby on Rails?

Ruby on Rails is defined as “a framework written in the Ruby programming language that implements the Model-View-Controller architectural template for web applications, as well as integrates them with a web server and database server. This is the most popular Ruby framework. It combines well with JavaScript, HTML, and CSS, runs on a web server, and simplifies frequent tasks.


  • Ruby
  • Tar
  • RVM or Gem
  • gnupg2


We will start our installation process with updating the current packages on our system.

[root@host ~]# dnf update
Failed to set locale, defaulting to C.UTF-8
CentOS-8 - AppStream                        	12 kB/s | 4.3 kB 	00:00	
CentOS-8 - Base                            	9.8 kB/s | 3.8 kB 	00:00	
CentOS-8 - Extras                          	3.8 kB/s | 1.5 kB 	00:00   
Dependencies resolved.
Nothing to do.
[root@host ~]#

Next, we need to ensure the following packages are installed and up to date. We will not install Ruby in this next command but will install it shortly.

  • Curl 
  • gnupg2
  • tar

To install these packages, we will use the following command.

[root@host ~]# dnf install curl gnupg2 tar
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 0:00:41 ago on Wed Mar  4 01:41:33 2020.
Package curl-7.61.1-11.el8.x86_64 is already installed.
Package gnupg2-2.2.9-1.el8.x86_64 is already installed.
Dependencies resolved.
 Package       Architecture 	Version             	Repository    	Size
 tar           x86_64       	2:1.30-4.el8        	BaseOS       	838 k
Transaction Summary
Install  1 Package
Total download size: 838 k
Installed size: 2.8 M
Is this ok [y/N]: y
Downloading Packages:
tar-1.30-4.el8.x86_64.rpm                  	2.9 MB/s | 838 kB 	00:00   
Total                                      	1.5 MB/s | 838 kB 	00:00 	
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing    	:                        	                           1/1
  Installing   	: tar-2:1.30-4.el8.x86_64                           	1/1
  Running scriptlet: tar-2:1.30-4.el8.x86_64                           	1/1
  Verifying    	: tar-2:1.30-4.el8.x86_64                	           1/1
[root@host ~]#

What is RVM (“Ruby Version Manager”)

We will be installing Ruby on Rails using RVM (or the Ruby Version Machine). RVM is a command line tool that allows us to install, manage, and work with different ruby environments.

RVM is similar to dnf, snappy, or Pypi. RVM allows you to install and manage multiple installations of Ruby on your system. It can also manage different gemsets. It is available for macOS, Linux, or other UNIX-like operating systems. Our next step is to download the RVM startup script

As always, be sure to verify the commands of any bash script before running it from an external source.
[root@host ~]# curl -sSL | bash
Creating group 'rvm'
Installing RVM to /usr/local/rvm/
Installation of RVM in /usr/local/rvm/ is almost complete:
  * First you need to add all users that will be using rvm to 'rvm' group,
	and logout - login again, anyone using rvm will be operating with umask u=rwx,g=rwx,o=rx.
  * To start using RVM you need to run source /etc/profile.d/
	in all your open shell windows, in rare cases you need to reopen all shell windows.
  * Please do NOT forget to add your users to the rvm group.
 	The installer no longer auto-adds root or users to the rvm group. Admins must do this.
 	Also, please note that group memberships are ONLY evaluated at login time.
 	This means that users must log out then back in before group membership takes effect!
Thanks for installing RVM 🙏
Please consider donating to our open collective to help us maintain RVM.
👉  Donate:

Now, we will need to add a user who will utilize the RVM group.

[root@host ~]# usermod -a -G rvm root
[root@host ~]#

Moving forward, we're going to update system environment variables.

[root@host ~]# source /etc/profile.d/
[root@host ~]#

Next, we will need to install the package requirements for Ruby

[root@host ~]# rvm requirements
Checking requirements for centos.
Installing requirements for centos.
Installing required packages: patch, autoconf, automake, bison, bzip2, gcc-c++, libffi-devel, libtool, make, patch, readline-devel, ruby, sqlite-devel, zlib-devel, glibc-headers, glibc-devel, openssl-devel...............................-
Requirements installation successful.

Ruby Installation

We will start the installation by checking the available versions of Ruby.

[root@host ~]# rvm list known
# MRI Rubies
[ruby-]1.8.7[-head] # security released on head
# for forks use: rvm install ruby-head-<name> --url --branch 2.2
# JRuby
# Rubinius
# TruffleRuby
# Opal
# Minimalistic ruby implementation - ISO 30170:2012
# Ruby Enterprise Edition
# Topaz
# MagLev
# Mac OS X Snow Leopard Or Newer
# IronRuby
[root@host ~]#

The most recent, and stable version is 2.7.0. We can install it by running the following RVM command.

[root@host ~]# rvm install 2.7.0
Searching for binary rubies, this might take some time.
No binary rubies available for: centos/8/x86_64/ruby-2.7.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for centos.
Requirements installation successful.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.7.0, this may take a while depending on your cpu(s)...
ruby-2.7.0 - #downloading ruby-2.7.0, this may take a while depending on your connection...
  % Total	% Received % Xferd  Average Speed   Time    Time 	Time  Current
                             	Dload  Upload   Total   Spent	Left  Speed
100 14.0M  100 14.0M	0     0  10.1M  	0  0:00:01  0:00:01 --:--:-- 10.1M
ruby-2.7.0 - #extracting ruby-2.7.0 to /usr/local/rvm/src/ruby-2.7.0.....
ruby-2.7.0 - #configuring.....................................................-
ruby-2.7.0 - #post-configuration..
ruby-2.7.0 - #compiling.......................................................-
ruby-2.7.0 - #installing..................
ruby-2.7.0 - #making binaries executable...
Installed rubygems 3.1.2 is newer than 3.0.8 provided with installed ruby, skipping installation, use --force to force installation.
ruby-2.7.0 - #gemset created /usr/local/rvm/gems/ruby-2.7.0@global
ruby-2.7.0 - #importing gemset /usr/local/rvm/gemsets/global.gems.............-
ruby-2.7.0 - #generating global wrappers.......
ruby-2.7.0 - #gemset created /usr/local/rvm/gems/ruby-2.7.0
ruby-2.7.0 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.7.0 - #generating default wrappers.......
ruby-2.7.0 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.7.0 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri
[root@host ~]#

Now, let’s set the default version of Ruby.

[root@host ~]# rvm use 2.7.0 --default
Using /usr/local/rvm/gems/ruby-2.7.0
[root@host ~]#

After installation, we can double-check whether it was installed and its version.

[root@host ~]# ruby --version
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]
[root@host ~]#

Now, we can install Rails.

[root@host ~]# gem install rails
Fetching i18n-1.8.2.gem
Fetching mini_portile2-2.4.0.gem
Fetching nokogiri-1.10.9.gem
Fetching concurrent-ruby-1.1.6.gem
Fetching loofah-2.4.0.gem
Fetching rails-html-sanitizer-1.3.0.gem
Fetching crass-1.0.6.gem
Fetching zeitwerk-2.3.0.gem
Fetching erubi-1.9.0.gem
Fetching rack-test-1.1.0.gem
Fetching activesupport-
Fetching thread_safe-0.3.6.gem
Fetching rails-dom-testing-2.0.3.gem
Fetching actionview-
Fetching rack-2.2.2.gem
Fetching tzinfo-1.2.6.gem
Fetching builder-3.2.4.gem
Fetching activemodel-
Fetching activerecord-
Fetching globalid-0.4.2.gem
Fetching actionpack-
Fetching actioncable-
Fetching mini_mime-1.0.2.gem
Fetching mail-2.7.1.gem
Fetching activejob-
Fetching actionmailbox-
Fetching nio4r-2.5.2.gem
Fetching websocket-extensions-0.1.4.gem
Fetching websocket-driver-0.7.1.gem
Fetching actionmailer-
Fetching sprockets-4.0.0.gem
Fetching marcel-0.3.3.gem
Fetching activestorage-
Fetching mimemagic-0.3.4.gem
Fetching thor-1.0.1.gem
Fetching method_source-0.9.2.gem
Fetching rails-
Fetching railties-
Fetching actiontext-
Fetching sprockets-rails-3.2.1.gem
Successfully installed concurrent-ruby-1.1.6
HEADS UP! i18n 1.1 changed fallbacks to exclude default locale.
But that may break your application.
If you are upgrading your Rails application from an older version of Rails:
Please check your Rails app for 'config.i18n.fallbacks = true'.
If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be
'config.i18n.fallbacks = [I18n.default_locale]'.
If not, fallbacks will be broken in your app by I18n 1.1.x.
If you are starting a NEW Rails application, you can ignore this notice.
For more info see:
Successfully installed i18n-1.8.2
Successfully installed thread_safe-0.3.6
Successfully installed tzinfo-1.2.6
Successfully installed zeitwerk-2.3.0
Successfully installed activesupport-
Successfully installed rack-2.2.2
Successfully installed rack-test-1.1.0
Successfully installed mini_portile2-2.4.0
Building native extensions. This could take a while...
Successfully installed nokogiri-1.10.9
Successfully installed crass-1.0.6
Successfully installed loofah-2.4.0
Successfully installed rails-html-sanitizer-1.3.0
Successfully installed rails-dom-testing-2.0.3
Successfully installed builder-3.2.4
Successfully installed erubi-1.9.0
Successfully installed actionview-
Successfully installed actionpack-
Successfully installed activemodel-
Successfully installed activerecord-
Successfully installed globalid-0.4.2
Successfully installed activejob-
Successfully installed mini_mime-1.0.2
Successfully installed mail-2.7.1
Successfully installed actionmailer-
Building native extensions. This could take a while...
Successfully installed nio4r-2.5.2
Successfully installed websocket-extensions-0.1.4
Building native extensions. This could take a while...
Successfully installed websocket-driver-0.7.1
Successfully installed actioncable-
Successfully installed mimemagic-0.3.4
Successfully installed marcel-0.3.3
Successfully installed activestorage-
Successfully installed actionmailbox-
Successfully installed actiontext-
Successfully installed thor-1.0.1
Successfully installed method_source-0.9.2
Successfully installed railties-
Successfully installed sprockets-4.0.0
Successfully installed sprockets-rails-3.2.1
Successfully installed rails-
Parsing documentation for concurrent-ruby-1.1.6
Installing ri documentation for concurrent-ruby-1.1.6
Parsing documentation for i18n-1.8.2
Installing ri documentation for i18n-1.8.2
Parsing documentation for thread_safe-0.3.6
Installing ri documentation for thread_safe-0.3.6
Parsing documentation for tzinfo-1.2.6
Installing ri documentation for tzinfo-1.2.6
Parsing documentation for zeitwerk-2.3.0
Installing ri documentation for zeitwerk-2.3.0
Parsing documentation for activesupport-
Installing ri documentation for activesupport-
Parsing documentation for rack-2.2.2
Installing ri documentation for rack-2.2.2
Parsing documentation for rack-test-1.1.0
Installing ri documentation for rack-test-1.1.0
Parsing documentation for mini_portile2-2.4.0
Installing ri documentation for mini_portile2-2.4.0
Parsing documentation for nokogiri-1.10.9
Installing ri documentation for nokogiri-1.10.9
Parsing documentation for crass-1.0.6
Installing ri documentation for crass-1.0.6
Parsing documentation for loofah-2.4.0
Installing ri documentation for loofah-2.4.0
Parsing documentation for rails-html-sanitizer-1.3.0
Installing ri documentation for rails-html-sanitizer-1.3.0
Parsing documentation for rails-dom-testing-2.0.3
Installing ri documentation for rails-dom-testing-2.0.3
Parsing documentation for builder-3.2.4
Installing ri documentation for builder-3.2.4
Parsing documentation for erubi-1.9.0
Installing ri documentation for erubi-1.9.0
Parsing documentation for actionview-
Installing ri documentation for actionview-
Parsing documentation for actionpack-
Installing ri documentation for actionpack-
Parsing documentation for activemodel-
Installing ri documentation for activemodel-
Parsing documentation for activerecord-
Installing ri documentation for activerecord-
Parsing documentation for globalid-0.4.2
Installing ri documentation for globalid-0.4.2
Parsing documentation for activejob-
Installing ri documentation for activejob-
Parsing documentation for mini_mime-1.0.2
Installing ri documentation for mini_mime-1.0.2
Parsing documentation for mail-2.7.1
Installing ri documentation for mail-2.7.1
Parsing documentation for actionmailer-
Installing ri documentation for actionmailer-
Parsing documentation for nio4r-2.5.2
Installing ri documentation for nio4r-2.5.2
Parsing documentation for websocket-extensions-0.1.4
Installing ri documentation for websocket-extensions-0.1.4
Parsing documentation for websocket-driver-0.7.1
Installing ri documentation for websocket-driver-0.7.1
Parsing documentation for actioncable-
Installing ri documentation for actioncable-
Parsing documentation for mimemagic-0.3.4
Installing ri documentation for mimemagic-0.3.4
Parsing documentation for marcel-0.3.3
Installing ri documentation for marcel-0.3.3
Parsing documentation for activestorage-
Installing ri documentation for activestorage-
Parsing documentation for actionmailbox-
Installing ri documentation for actionmailbox-
Parsing documentation for actiontext-
Installing ri documentation for actiontext-
Parsing documentation for thor-1.0.1
Installing ri documentation for thor-1.0.1
Parsing documentation for method_source-0.9.2
Installing ri documentation for method_source-0.9.2
Parsing documentation for railties-
Installing ri documentation for railties-
Parsing documentation for sprockets-4.0.0
Installing ri documentation for sprockets-4.0.0
Parsing documentation for sprockets-rails-3.2.1
Installing ri documentation for sprockets-rails-3.2.1
Parsing documentation for rails-
Installing ri documentation for rails-
Done installing documentation for concurrent-ruby, i18n, thread_safe, tzinfo, zeitwerk, activesupport, rack, rack-test, mini_portile2, nokogiri, crass, loofah, rails-html-sanitizer, rails-dom-testing, builder, erubi, actionview, actionpack, activemodel, activerecord, globalid, activejob, mini_mime, mail, actionmailer, nio4r, websocket-extensions, websocket-driver, actioncable, mimemagic, marcel, activestorage, actionmailbox, actiontext, thor, method_source, railties, sprockets, sprockets-rails, rails after 34 seconds
40 gems installed
[root@host ~]#

Next, we can check the version of Rails we just installed by using the following command.

[root@host ~]# rails -v
[root@host ~]#

If we want to use a specific version of Rails, we can use the following command.

[root@host ~]# gem install rails –v [insert.number.version]


Now that we have Ruby on Rails installed on the server, we can begin using it as a powerful foundation for our Ruby application development. After installing Ruby on Rails, you can start creating an SSL certificate or installing an FTP server.

Should you experience any issues with install, you can always give us a call at 800.580.4985, or open a chat or ticket with us to speak with one of our knowledgeable systems administrators today!

Avatar for Ellen Sletton

About the Author: Ellen Sletton

I'm 23 years old Linux Tech who always takes NO as Next Opportunity. Every day I'm trying to learn something new and share my knowledge with others. My free time I spend with my dog Emil or doing some UI/UX design or simply making an inspiring photo for my blog :) Sharing knowledge helps me generate new ideas and stay motivated.

Latest Articles

Controlling PHP settings with a custom php.ini file

Read Article

How to install Puppet Server on Linux (AlmaLinux)

Read Article

Email security best practices for using SPF, DKIM, and DMARC

Read Article

Linux dos2unix command syntax — removing hidden Windows characters from files

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article