In this guide, we will look at how you can Install Ruby 2.5 on RHEL 8 / CentOS 8 Linux. Ruby is a dynamic, open source, object-oriented scripting language created with simplicity and productivity in mind. In this guide, I’ll show you how to Install Ruby 2.5 on RHEL 8 / CentOS 8 with RVM Ruby Version Manager.
Step 1: Install Ruby 2.5 on RHEL 8 / CentOS 8
RHEL 8 provides Ruby 2.5 in Appstream repository. You can confirm its availability using the command:
$ sudo yum module list | grep ruby ruby 2.5 [d] default [d] An interpreter of object-oriented scripting language
Since it is the only module of Ruby available, it can be installed by just running:
sudo yum install @ruby
To specify the module version, use the command:
sudo yum install @ruby:2.5
Once installed, check version:
$ ruby --version ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
Step 2: Install RVM on RHEL 8 / CentOS 8
RVM is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems. Install RVM on RHEL 8 by running the commands below in your terminal
curl -sSL https://rvm.io/mpapis.asc | sudo gpg --import - curl -L get.rvm.io | sudo bash -s stable
Add all users that will be using rvm to ‘rvm‘ group
sudo usermod -aG rvm $USER
$ sudo usermod -aG rvm jmutai $ id jmutai uid=1000(jmutai) gid=1000(jmutai) groups=1000(jmutai),10(wheel),1001(rvm)
To start using RVM you need to run:
$ source /etc/profile.d/rvm.sh $ rvm reload RVM reloaded!
Step 3: Install RVM dependencies
Install dependencies by running the command:
# rvm requirements run Checking requirements for centos. Installing requirements for centos. Installing required packages: libffi-devel, readline-devel, sqlite-devel, zlib-devel, openssl-devel\ ................ Requirements installation successful.
A different version of Ruby can be installed using
rvm install 2.5.2
You have successfully installed Ruby on RHEL 8 / CentOS 8.