CentOS 7
Sponsored Link

Install Ruby 2.72020/07/20

 
The version of Ruby in CentOS 7 repository is 2.0 but Install 2.7 with RPM package if you need.
[1] It's possible to install from CentOS SCLo Software Collections.
It's OK to install it even if 2.0 is already installed because 2.7 is located on another PATH.
# install from SCLo

[root@dlp ~]#
yum --enablerepo=centos-sclo-rh -y install rh-ruby27
[2] Packages from Software Collections are installed uder the [/opt] directory.
To use it, Load environment variables like follows.
# load environment variables

[root@dlp ~]#
scl enable rh-ruby27 bash
[root@dlp ~]#
ruby -v

ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
[root@dlp ~]#
which ruby

/opt/rh/rh-ruby27/root/usr/bin/ruby
[3] If you'd like to enable Ruby 2.7 automatically at login time, configure like follows.
[root@dlp ~]#
vi /etc/profile.d/rh-ruby27.sh
# create new

source /opt/rh/rh-ruby27/enable
export X_SCLS="`scl enable rh-ruby27 'echo $X_SCLS'`"
Matched Content