CentOS 8
Sponsored Link

Ruby 2.6 : Install2020/01/31

Install Ruby 2.6.
[1] Make sure the current enabled version of Ruby and Install it.
[root@dlp ~]#
dnf module list ruby

CentOS-8 - AppStream
Name Stream     Profiles       Summary
ruby 2.5 [d][e] common [d] [i] An interpreter of object-oriented scripting language
ruby 2.6        common         An interpreter of object-oriented scripting language

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

# if other versions are enabled, reset once and switch to the version

[root@dlp ~]#
dnf module reset ruby

[root@dlp ~]#
dnf module enable ruby:2.6
# update to Ruby 2.6

[root@dlp ~]#
dnf module -y update ruby:2.6

Dependencies resolved.
 Package           Arch   Version                               Repo       Size
 rubygem-irb       noarch 1.0.0-106.module_el8.1.0+249+93480f15 AppStream 111 k
     replacing  ruby-irb.noarch 2.5.5-105.module_el8.1.0+214+9be47fd7
 ruby              x86_64 2.6.3-106.module_el8.1.0+249+93480f15 AppStream  87 k
 ruby-libs         x86_64 2.6.3-106.module_el8.1.0+249+93480f15 AppStream 3.0 M
                   x86_64 1.4.1-106.module_el8.1.0+249+93480f15 AppStream 101 k
                   noarch 1.3.0-106.module_el8.1.0+249+93480f15 AppStream  82 k
                   x86_64 0.4.7-106.module_el8.1.0+249+93480f15 AppStream  67 k
 rubygem-json      x86_64 2.1.0-106.module_el8.1.0+249+93480f15 AppStream  90 k
 rubygem-openssl   x86_64 2.1.2-106.module_el8.1.0+249+93480f15 AppStream 190 k
 rubygem-psych     x86_64 3.1.0-106.module_el8.1.0+249+93480f15 AppStream  96 k
 rubygem-rdoc      noarch 6.1.0-106.module_el8.1.0+249+93480f15 AppStream 487 k
 rubygems          noarch 3.0.3-106.module_el8.1.0+249+93480f15 AppStream 315 k

Transaction Summary
Install   1 Package
Upgrade  10 Packages

[root@dlp ~]#
ruby -v

ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]

# verify to create test script

[root@dlp ~]# cat > ruby_test.rb <<'EOF' 
msg = Class.send(:new, String);
mymsg = msg.send(:new, "Hello Ruby World !\n");
STDOUT.send(:write, mymsg)

[root@dlp ~]#
ruby ruby_test.rb

Hello Ruby World !
Matched Content