CentOS Stream 9
Sponsored Link

Ruby 3.1 : Install2022/07/12

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

CentOS Stream 9 - AppStream
Name   Stream  Profiles    Summary
ruby   3.1     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 -y reset ruby

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

Dependencies resolved.
================================================================================
 Package            Arch   Version                              Repo       Size
================================================================================
Installing group/module packages:
 ruby               x86_64 3.1.2-141.module_el9+156+2e0939d1    appstream  41 k
Installing dependencies:
 ruby-default-gems  noarch 3.1.2-141.module_el9+156+2e0939d1    appstream  40 k
 ruby-libs          x86_64 3.1.2-141.module_el9+156+2e0939d1    appstream 3.3 M
 rubygem-io-console x86_64 0.5.11-141.module_el9+156+2e0939d1   appstream  25 k
 rubygem-json       x86_64 2.6.1-141.module_el9+156+2e0939d1    appstream  57 k
 rubygem-psych      x86_64 4.0.3-141.module_el9+156+2e0939d1    appstream  58 k
Installing weak dependencies:
 rubygem-bigdecimal x86_64 3.1.1-141.module_el9+156+2e0939d1    appstream  69 k
 rubygem-bundler    noarch 2.3.7-141.module_el9+156+2e0939d1    appstream 453 k
 rubygem-rdoc       noarch 6.4.0-141.module_el9+156+2e0939d1    appstream 499 k
 rubygems           noarch 3.3.7-141.module_el9+156+2e0939d1    appstream 297 k
Installing module profiles:
 ruby/common

Transaction Summary
================================================================================
Install  10 Packages
.....
.....

[root@dlp ~]#
ruby -v

ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [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