Setup Ruby on CentOS 8

This guide explains how to setup Ruby on CentOS using Ruby version manager.

Prerequisite 

CentOS 8 minimal installation with latest available updates

Resolve Dependencies 

To begin with Ruby installation, it requires a set of packages on the system. Following steps to resolve the same. 

dnf install curl 
 
dnf install gnupg2 
  
dnf install tar

Installing Ruby Version Manager (RVM)

    RVM is a command-line tool that allows us to install, manage, and work with different ruby environments.
    Install the latest stable version of RVM on your system using the following command. This command will automatically download all required files and install on your system.

Install GPG keys

As a first step install GPG keys used to verify installation package:
Key can be found at RVM website

Eg :
gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

Above key information is a sample do not copy. Do refer website for updated key information

Install RVM

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

Add user root to user group rvm, group rvm created while installing RVM.

usermod -a -G rvm root

Update/Setup RVM Environment

The command makes the target system environment ready

source /etc/profile.d/rvm.sh

reload rvm source 

rvm reload

Install Ruby requirements

External packages required for Ruby can be resolved by installing the following command

rvm requirements

Ruby Installation

List all available version of ruby for installation

rvm list known

Chose one version from the list and perform install command with the version

rvm install 2.7.0

Note: Above command install ruby with version 2.7.0, Change the version number based on requirements.

Set Ruby default version

if multiple version of ruby installed, set a version as default.

rvm use 2.7.0 --default

Verify the default version

ruby --version

The version printed should match with the version set as default.

List locally available ruby version

rvm list

It lists all version of ruby present in the target system



Sources used :

Comments

Popular posts from this blog

python-docx | docx | No module named 'exceptions'

Fixing TortoiseSVN icons overlay in Windows 10

MySQL 8 User creation and grant privileges