CentOS Stream 9
Sponsored Link

Ruby 3.3 : インストール2024/06/04

 
Ruby 3.3 をインストールします。
[1] 現在、有効になっている Ruby のバージョンを確認してインストールします。
[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
ruby   3.3     common [d]  An interpreter of object-oriented scripting language

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

# 他バージョンが有効な場合は一旦リセットして有効バージョンを切り替え

[root@dlp ~]#
dnf module -y reset ruby

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

Dependencies resolved.
================================================================================
 Package             Arch    Version                           Repository  Size
================================================================================
Installing group/module packages:
 ruby                x86_64  3.3.0-1.module_el9+862+220991ec   appstream   38 k
Installing dependencies:
 ruby-default-gems   noarch  3.3.0-1.module_el9+862+220991ec   appstream   45 k
 ruby-libs           x86_64  3.3.0-1.module_el9+862+220991ec   appstream  4.1 M
 rubygem-io-console  x86_64  0.7.1-1.module_el9+862+220991ec   appstream   22 k
 rubygem-json        x86_64  2.7.1-1.module_el9+862+220991ec   appstream   56 k
 rubygem-psych       x86_64  5.1.2-1.module_el9+862+220991ec   appstream   57 k
Installing weak dependencies:
 rubygem-bigdecimal  x86_64  3.1.5-1.module_el9+862+220991ec   appstream   65 k
 rubygem-bundler     noarch  2.5.3-1.module_el9+862+220991ec   appstream  474 k
 rubygem-rdoc        noarch  6.6.2-1.module_el9+862+220991ec   appstream  502 k
 rubygems            noarch  3.5.3-1.module_el9+862+220991ec   appstream  381 k
Installing module profiles:
 ruby/common

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

[root@dlp ~]#
ruby -v

ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-linux]

# テストスクリプトを作成して動作確認

[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 !
関連コンテンツ