How to install Ruby on CentOS 9 Stream

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

Hello, friends. In this post, you will learn how to install Ruby on CentOS 9 Stream. This programming language is one of the classics, but still important for many applications and scripts.

According to Wikipedia:

Ruby is an interpreted, high-level, general-purpose programming language which supports multiple programming paradigms. It was designed with an emphasis on programming productivity and simplicity.

It is a veteran programming language that has been with us for a long time, so it is in a mature, stable and well-documented phase of its development cycle.

Although it has lost some popularity, the truth is that Ruby is still widely used in advanced configuration scripts, as well as in applications of all kinds as robust as certain components of Twitter or Amazon.

So let’s get started.

Installing Ruby on CentOS 9 Stream

Fortunately, we have several ways to install Ruby. The choice is up to you and your needs.

Installing Ruby from the CentOS 9 Stream repositories

The first way to install Ruby is to install it from the official CentOS 9 Stream repositories. This procedure is simple and is recommended for most users.

So, open a terminal and update the whole system

sudo dnf update

Now install some recommended packages for Ruby installation:

sudo dnf install gnupg2 curl tar

Thereafter, you have to run the following command to install Ruby.

sudo dnf install ruby
1.- Install Ruby on CentOS 9 Stream
1.- Install Ruby on CentOS 9 Stream

This will install Ruby completely on your system.

Verify the installed version with this command

ruby --version

Output:

ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-linux]

Install Ruby using RVM

RMV (Ruby Version Manager) is a CLI tool that allows you to install a specific version of Ruby. This method is ideal if you want a specific version or the latest version.

First install RVM:

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

Then, add your user to the rvm group that has been created.

sudo usermod -aG rvm $USER

Apply the changes:

source /etc/profile.d/rvm.sh

And restart RVM

rvm reload
RVM reloaded!

For RVM to work properly, some requirements must be installed. Everything can be done with this command:

rvm requirements
Checking requirements for centos.
Requirements installation successful.

Then, check the list of versions you can install:

rvm list known

Now choose the Ruby version you prefer, for example:

rvm install ruby 3.1.2
Install of ruby-3.1.2 - #complete 
Ruby was built without documentation, to build it run: rvm docs generate-ri

Finally, display the installed version:

ruby --version
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
2.- Ruby programming language
2.- Ruby programming language

If you have another version of Ruby installed, you can set one as the default:

rvm use 3.1.2 --default

So, that’s all.

Conclusion

In this post, you learned how to install Ruby on CentOS 9 Stream, which is a very popular system among developers looking for a stable and robust system for software creation.

More posts about CentOS 9 Stream

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Angelo
Angelo
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook