Share your love
How To Set up Ruby on Rails on AlmaLinux 8
In this article, we want to teach you How To Set up Ruby on Rails on AlmaLinux 8.
Ruby on Rails (sometimes RoR) is the most popular open-source web application framework. Itβs built with the Ruby programming language.
You can use Rails to help you build applications, from simple to complex, there are no limits to what you can accomplish with Rails!
How To Set up Ruby on Rails on AlmaLinux 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 AlmaLinux 8.
Now follow the steps below to install Ruby on Rails on your server.
Install Ruby on Rails on AlmaLinux 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 AlmaLinux 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 AlmaLinux 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://rvm.io]
Install Rails with Gem on AlmaLinux 8
At this point, you can install Rails on AlmaLinux 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
Conclusion
At this point, you learn to Set up Ruby on Rails on AlmaLinux 8. You can now go ahead and write your programs.
Hope you enjoy it.