CentOS Stream 8
Sponsored Link

Ruby 2.7 : Install2021/04/09

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

CentOS Stream 8 - AppStream
Name Stream  Profiles       Summary
ruby 2.5 [d] common [d]     An interpreter of object-oriented scripting language
ruby 2.6 [e] common [d] [i] 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.7
# install Ruby 2.7

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

Dependencies resolved.
================================================================================
 Package           Arch   Version                               Repo       Size
================================================================================
Upgrading:
 ruby              x86_64 2.7.1-133.module_el8.3.0+429+625e5e4e appstream  88 k
 ruby-devel        x86_64 2.7.1-133.module_el8.3.0+429+625e5e4e appstream 261 k
 ruby-libs         x86_64 2.7.1-133.module_el8.3.0+429+625e5e4e appstream 3.2 M
 rubygem-bigdecimal
                   x86_64 2.0.0-133.module_el8.3.0+429+625e5e4e appstream 100 k
 rubygem-io-console
                   x86_64 0.5.6-133.module_el8.3.0+429+625e5e4e appstream  71 k
 rubygem-json      x86_64 2.3.0-133.module_el8.3.0+429+625e5e4e appstream  92 k
 rubygem-openssl   x86_64 2.1.2-133.module_el8.3.0+429+625e5e4e appstream 196 k
 rubygem-psych     x86_64 3.1.0-133.module_el8.3.0+429+625e5e4e appstream  96 k
 rubygems          noarch 3.1.2-133.module_el8.3.0+429+625e5e4e appstream 307 k
Installing weak dependencies:
 rubygem-bundler   noarch 2.1.4-133.module_el8.3.0+429+625e5e4e appstream 387 k
Installing module profiles:
 ruby/common

Transaction Summary
================================================================================
Install  1 Package
Upgrade  9 Packages
.....
.....

[root@dlp ~]#
ruby -v

ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [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