In this tutorial, you will learn to Install Ruby on Rails on AlmaLinux 9 Step by Step.
You can use the Ruby on Rails web application framework to build your application. It has been said that it is the most powerful web application platform.
Now follow the steps below to set up Ruby on Rails on AlmaLinux 9:
- Install RVM (Ruby Version Manager)
- Use rvm to install the Ruby
- Use gems to install the Rails
Steps To Install Ruby on Rails on AlmaLinux 9
To complete this guide, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow this guide on Initial Server Setup with AlmaLinux 9.
Step 1 – Install RVM on AlmaLinux 9
First, you need to run the system update with the command below:
sudo dnf update -y
Then, use the following curl command to download and install RVM:
\curl -sSL https://get.rvm.io | bash
When your installation is completed, you will get the following output:
Output ... Thanks for installing RVM 🙏
Add Regular Users To the RVM Group
At this point, you should add the users to the RVM group because the installer no longer auto-adds root or users to the RVM group.
First, create your users with the following command:
Next, use the following command to add the user to the RVM group:
usermod -aG rvm orca
Source the RVM
Now you need to source the following file by using the command below:
Apply the changes by using the following command:
Output RVM reloaded!
Install RVM Package Requirements
At this point, you need to install the package requirements with the following command:
Output Requirements installation successful.
Step 2 – Install Ruby with RVM on AlmaLinux 9
Now you can check for the latest version available of Ruby with the following RVM command:
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[.8] [ruby-]3.0[.6] [ruby-]3.1[.4] [ruby-]3[.2.2] [ruby-]3.3[.0-preview1] ruby-head ...
As you can see, the latest version of Ruby is version 3.1.4. To install it, simply run the command below:
rvm install ruby 3.1.4
This may take some time to complete. When it is completed, verify your Ruby installation by checking its version on AlmaLinux 9:
Output ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) [x86_64-linux]
Also, you can check for your RVM version:
Output rvm 1.29.12-next (master) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
Sep 3 – Install Rails with Gem
Gem is a library that contains a specific piece of functionality as well as any files or assets related to that functionality in Ruby. At this point, you can easily use Gem to install the Rails:
gem install rails
Output ... 35 gems installed
Verify your Rails installation by checking its version:
Output Rails 18.104.22.168
For more information, you can visit the Ruby on Rails guides.
At this point, you have learned to Install Ruby on Rails by using the RVM (Ruby Version Manager) on AlmaLinux 9. Now you can write your programs with Ruby on Rails the most powerful application platform.
Hope you enjoy it. You may be interested in these articles:
How To Install Portainer on AlmaLinux 9