RHEL BasedRocky Linux

How To Install Ruby on Rails on Rocky Linux 9

Install Ruby on Rails on Rocky Linux 9

In this tutorial, we will show you how to install Ruby on Rails on Rocky Linux 9. For those of you who didn’t know, Ruby on Rails is a web-app framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern. With the complexity of modern web applications, Rails makes web development easier with the pre-built structure for development, providing all the required tools to build an app.

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 Ruby on Rails on Rocky Linux. 9.

Prerequisites

  • A server running one of the following operating systems: Rocky Linux 9.
  • 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 user or 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 Rocky Linux 9

Step 1. The first step is to update your system to the latest version of the package list. To do so, run the following commands:

sudo dnf check-update
sudo dnf install dnf-utils

Step 2. Installing Install RVM (Ruby Version Manager).

By default, RVM is not available on Rocky Linux 9 base repository. Now run the following command below to install the latest version of RVM to your Rocky Linux system:

curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -
curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
sudo dnf -y install tar
curl -sSL https://get.rvm.io | bash -s stable

Next, update the system environment using the following command:

source /etc/profile.d/rvm.sh
rvm reload

Then, install all the required packages:

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:

# 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[-p648]
[ruby-]2.1[.10]
[ruby-]2.2[.10]
[ruby-]2.3[.8]
[ruby-]2.4[.10]
[ruby-]2.5[.8]
[ruby-]2.6[.6]
[ruby-]2.7[.2]
[ruby-]3[.0.4]
ruby-head

# for forks use: rvm install ruby-head-<name> --url https://github.com/github/ruby.git --branch 2.2

# JRuby
jruby-1.6[.8]
jruby-1.7[.27]
jruby-9.1[.17.0]
jruby[-9.2.14.0]
jruby-head
.........

I will go ahead with the installation of Ruby 3.0.4 in this example:

rvm install ruby 3.0.4

Check the version of Ruby using the following command:

ruby --version

Also, check the rvm version:

rvm version

Step 3. Installing Rails on Rocky Linux 9.

Once Ruby has been installed, we can easily install Rails as a Gem. Run the following command below to install it:

gem install rails

Lastly, check if rails have been installed with rails –version command:

rails --version

Congratulations! You have successfully installed Ruby on Rails. Thanks for using this tutorial for installing Ruby on Rails on your Rocky Linux 9 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!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button