CentOS Stream 8
Sponsored Link

Ruby 2.6 : Install2021/04/09

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

CentOS Stream 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 [d]     An interpreter of object-oriented scripting language
ruby 2.7        common [d]     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
# install Ruby 2.6

[root@dlp ~]#
dnf module -y install ruby:2.6/common

Dependencies resolved.
================================================================================
 Package           Arch   Version                               Repo       Size
================================================================================
Upgrading:
 ruby              x86_64 2.6.3-106.module_el8.1.0+249+93480f15 appstream  87 k
 ruby-devel        x86_64 2.6.3-106.module_el8.1.0+249+93480f15 appstream 243 k
 ruby-libs         x86_64 2.6.3-106.module_el8.1.0+249+93480f15 appstream 3.0 M
 rubygem-bigdecimal
                   x86_64 1.4.1-106.module_el8.1.0+249+93480f15 appstream 101 k
 rubygem-io-console
                   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
Installing dependencies:
 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
Installing module profiles:
 ruby/common

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)
EOF 

[root@dlp ~]#
ruby ruby_test.rb

Hello Ruby World !
Matched Content