22 C
Texas
angeloma
Senior Writer and partner

How to install Ruby on CentOS 8?

Ruby is one of those programming languages that may be a little underestimated. However, it is a robust, multipurpose, open-source language that stands out for its efficiency in coding applications. So, in this post, you will learn how to install Ruby on CentOS 8.

Install Ruby on CentOS using RVM

According to the project’s own website, RVM (Ruby version manager), RVM is a command-line tool that allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems. In short, with this tool, you can easily install different versions of Ruby on any system.

By using RVM, you have the main advantage of being able to install the latest stable version of the language. As mentioned earlier, we can install different versions of Ruby.

So, let’s install RVM and then install Ruby.

- Advertisement -

First, we need to install some pre-installed packages. You can do this with the following command:

:~$ su
:~# dnf install curl gnupg2 tar

You may already have them installed, but it’s better to be safe.

Then, we proceed to download and run the RVM installation script.

:~# curl -sSL https://get.rvm.io | bash
1.- Install RVM on CentOS 8
1.- Install RVM on CentOS 8

The installation should be pretty quick. In the image above we are encouraged to add the users who will be using RVM to the rvm group. In my case, I have only one user and I have added it with the following command

:~# usermod -a -G rvm angelo

Finally, the system environment variables need to be refreshed, so that the ruby variables are added.

:~# source /etc/profile.d/rvm.sh

Now we can use RVM. First of all, we need to install the package requirements that Ruby requires. This is as simple as running the following command:

:~# rvm requirements
2.- Install required packages for ruby
2.- Install required packages for ruby

Then we can check out all the versions of Ruby that we can install with RVM.

:~# rvm list known
3.- Ruby versions
3.- Ruby versions

And finally install the version we want, in this case, I will choose 2.7.0.

:~# rvm install 2.7.0
4.- Install Ruby on CentOS 8
4.- Install Ruby on CentOS 8

To avoid confusion if there are different versions, it is convenient to indicate which one the system will use by default:

:~# rvm use 2.7.0 --default

To check if everything has been successful, just show the current version of ruby

:~# ruby --version

So, that is it. Now you can start working with Ruby.

Conclusion

Ruby is a pretty powerful language. It seems to be given little credit, but it is still widely used and large server applications, as well as scripts, are developed with this language.

Please share this post and join our Telegram channel.

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

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article