CentOS Stream 8
Sponsored Link

Ruby 2.5 : インストール2021/04/09

 
Ruby 2.5 をインストールします。
[1] 現在、有効になっている Ruby のバージョンを確認してインストールします。
[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      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

# Ruby 2.5 を指定してインストール

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

Dependencies resolved.
========================================================================================
 Package                Arch    Version                                 Repo        Size
========================================================================================
Installing group/module packages:
 ruby                   x86_64  2.5.5-105.module_el8.1.0+214+9be47fd7   appstream   86 k
Installing dependencies:
 ruby-irb               noarch  2.5.5-105.module_el8.1.0+214+9be47fd7   appstream  102 k
 ruby-libs              x86_64  2.5.5-105.module_el8.1.0+214+9be47fd7   appstream  2.9 M
 rubygem-json           x86_64  2.1.0-105.module_el8.1.0+214+9be47fd7   appstream   90 k
 rubygem-openssl        x86_64  2.1.2-105.module_el8.1.0+214+9be47fd7   appstream  190 k
 rubygem-psych          x86_64  3.0.2-105.module_el8.1.0+214+9be47fd7   appstream   95 k
Installing weak dependencies:
 rubygem-bigdecimal     x86_64  1.3.4-105.module_el8.1.0+214+9be47fd7   appstream   97 k
 rubygem-did_you_mean   noarch  1.2.0-105.module_el8.1.0+214+9be47fd7   appstream   90 k
 rubygem-io-console     x86_64  0.4.6-105.module_el8.1.0+214+9be47fd7   appstream   66 k
 rubygem-rdoc           noarch  6.0.1-105.module_el8.1.0+214+9be47fd7   appstream  486 k
 rubygems               noarch  2.7.6.2-105.module_el8.1.0+214+9be47fd7 appstream  308 k
Installing module profiles:
 ruby/common
Enabling module streams:
 ruby                           2.5

Transaction Summary
========================================================================================
Install  11 Packages
.....
.....

[root@dlp ~]#
ruby -v

ruby 2.5.5p157 (2019-03-15 revision 67260) [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 !
関連コンテンツ