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.
- 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).
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 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:
After this we now need to check the versions of Ruby available then we install the latest version available:
rvm list known
# 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[-126.96.36.199] 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:
Also, check the
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:
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.