Monday, October 3, 2022

How To Set up Ruby on Rails on Rocky Linux 8

In this guide, we want to teach you How To Set up Ruby on Rails on Rocky Linux 8.

Ruby on Rails (or “Rails”) is an open-source web application development framework written in the Ruby programming language. It’s one of the most popular Ruby libraries and one of the top reasons developers choose to learn Ruby.

Modern web applications can be very complex with many layers. Rails make web development easier, providing a pre-built structure for the development and everything you need to build a web app.

Ruby on Rails is one of the best choices of frameworks if:

  • You need to handle complex business logic
  • You need to find developers to build an application readily and quickly
  • You have a limited budget
  • You want to deliver a web app quickly

How To Set up Ruby on Rails on Rocky Linux 8

To set up Ruby on Rails, you need to log in to your server as a non-root user with sudo privileges. To do this, you can follow our article the Initial Server Setup with Rocky Linux 8.

Now follow the steps below to install Ruby on Rails on your server.

Install Ruby on Rails on Rocky Linux 8

First, you need to update your local package index with the following command:

sudo dnf update -y

Then, install the dependencies on your server with the command below:

sudo dnf install gnupg2 wget curl -y

At this point, you need to install the development version of RVM with the following command:

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

When your installation is completed, you will get the following output:

Output
...
Thanks for installing RVM 🙏
Please consider donating to our open collective to help us maintain RVM.

👉 Donate: https://opencollective.com/rvm/donate

Now you need to install regular users to the RVM group because the installer no longer auto-adds root or users to the RVM group. To do this, run the following command with your desired name:

adduser orca

Next, add your user to the RVM group:

usermod -aG rvm orca

To start using RVM we need to run the command below in order to add it to /usr/local/rvm file:

source /usr/local/rvm/scripts/rvm

To apply the changes, reload RVM with the command below:

rvm reload
Output
RVM reloaded!

Then, you need to install the package requirements with the following command:

rvm requirements

When your installation is completed, you will get the following output:

Output
Requirements installation successful.

Now check the versions of Ruby available then install the latest version available on Rocky Linux 8:

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[.9]
[ruby-]2.6[.10]
[ruby-]2.7[.6]
[ruby-]3.0[.4]
[ruby-]3[.1.2]
[ruby-]3.2[.0-preview-1]
...

At this point, you can install Ruby v3.0.4 on Rocky Linux 8 with the following command:

rvm install ruby 3.0.4

To verify your installation, check your Ruby version:

ruby --version
Output
ruby 3.0.4p208 (2022-04-12 revision 3fa771dded) [x86_64-linux]

Also, check the RVM version:

rvm version
Output
rvm 1.29.12-next (master) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rv

Install Rails with Gem on Rocky Linux 8

At this point, you can install Rails on Rocky Linux 8 with the following command:

gem install rails
Output
...
35 gems installed

Verify your Rails installation by checking its version:

rails --version
Output
Rails 7.0.2.3

That’s it! you are done.

For more information, you can visit the Ruby on Rails Guides.

Conclusion

Ruby on Rails is used in all types of industries to build web apps and services. This includes applications like marketing websites, CMSs, eCommerce sites, and custom web applications. It’s a popular web framework for startups because its ease of use makes for quick application development with small teams.

Hope you enjoy it.

Please subscribe to us on Facebook and Twitter.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles