Install Ruby on Rocky Linux
Enable EPEL
Rocky Linux keeps the base system lean and ships many developer tools through EPEL, the Extra Packages for Enterprise Linux collection.
Enable EPEL once with dnf before you install Ruby. After that step the package manager can find Ruby and its dependencies without extra setup.
Install Ruby with dnf
With the repositories ready, one dnf command installs Ruby for the whole system:
Install Ruby
sudo dnf install ruby
Confirm the install when dnf shows the package summary. It adds the ruby and gem commands so every new terminal can use them right away.
ruby -v and gem -v
Check what was installed with one short command:
Show the installed Ruby version
ruby -v
Rocky Linux 10.2:
ruby 3.3.12 (2026-07-16 revision 0581089df9) [x86_64-linux]
Rocky Linux 9:
ruby 3.0.7p220 (2024-04-23 revision 724a071175) [x86_64-linux]
The version depends on the release: Rocky 10 packages Ruby 3.3, Rocky 9 packages 3.0. The lessons were run on Ruby 3.4, and Ruby 3.0 is too old for them: Data.define in the data lesson needs Ruby 3.2, so a Rocky 9 system Ruby needs a version manager.
Show the installed gem version
gem -v
Rocky Linux 10.2:
3.5.22
Rocky Linux 9:
3.2.33
If the terminal reports that either command was not found, repeat the dnf step above.
Notes on newer versions
Enterprise distributions favor stability over freshness, so the packaged Ruby may lag behind the newest release. Check the version against the course before you start: the lessons were run on Ruby 3.4 and need at least Ruby 3.2.
When a project later requires a newer Ruby, use a version manager such as rbenv or a container image. Those options live beside the system Ruby and leave the base system untouched.
Article author: Arthur Isaev