How To Install Ruby on Rails on AlmaLinux 8

Install Ruby on Rails on AlmaLinux 8

In this tutorial, we will show you how to install Ruby on Rails on AlmaLinux 8. For those of you who didn’t know, Ruby on Rails, or Rails, is an open-source web application development framework written in Ruby programming language. Rails is a server-side web application framework that facilitates the use of web standards. It is a full-stack web framework that uses the model-view-controller (MVC) pattern. Ruby on Rails is used by notable organizations such as GitHub, Crunchbase, Bloomberg, and much more.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Ruby on Rails open-source web framework on AlmaLinux 8. You can follow the same instructions for Fedora, RHEL, CentOS, and Rocky Linux distributions.

Prerequisites

  • A server running one of the following operating systems: AlmaLinux 8.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo useror access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Ruby on Rails on AlmaLinux 8

Step 1. First, let’s start by ensuring your system is up-to-date.

sudo dnf clean all
sudo dnf install gnupg2 curl
sudo dnf update

Step 2. Installing Ruby on AlmaLinux 8.

By default, Ruby is not available on the AlmaLinux 8 base repository. Now we run the following command to install (RVM) Ruby Version Manager to your system:

curl -sSL https://get.rvm.io | bash

After the installation is done, add the regular user to the RVM group as shown:

adduser idroot
usermod -aG rvm idroot

Next, update the system environment variables by executing the command:

source /etc/profile.d/rvm.sh

Let’s reload RVM for the changes to take effect with the following command:

rvm reload
rvm requirements

After this we now need to check the versions of Ruby available then we install the latest version available:

rvm list known

Output:

[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[.10]
[ruby-]2.3[.8]
[ruby-]2.4[.10]
[ruby-]2.5[.9]
[ruby-]2.6[.9]
[ruby-]2.7[.5][ruby-]3[.0.3]
[ruby-]3.1[.0-preview1]
ruby-head

As of writing this guide, the latest available Ruby version was 3.0.3. To install Ruby using the RVM manager run the command:

rvm install ruby 3.0.3

To make the above version the default version for Ruby, run the command:

rvm use 3.0.3 --default

Check the Ruby version:

ruby --version

Step 3. Installing Rails on AlmaLinux 8.

Now it’s time to install Rails on AlmaLinux 8 system. We can do this conveniently by using the gem command:

gem install rails

Verify the Rails version:

rails --version

Congratulations! You have successfully installed Ruby on Rails. Thanks for using this tutorial for installing the Ruby on Rails open-source web application framework on your AlmaLinux 8 system. For additional help or useful information, we recommend you check the official Ruby on Rails website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!