Install Ruby on Ubuntu
Update apt
On Ubuntu you install Ruby from the system repositories. Start by refreshing the package list so apt knows the latest available versions.
This step is quick and it prevents the classic problem where apt tries to fetch an outdated package record.
Refresh the package list
sudo apt update
Wait until the update finishes without errors. If the network was offline, run the same command again once the connection is back.
Install ruby-full
The ruby-full package brings Ruby plus documentation and common extensions used later in this course:
Install Ruby with extras
sudo apt install ruby-full
Confirm the install when apt asks for it. The download is small and it places the ruby and gem commands where every terminal can find them.
ruby -v and gem -v
Check both tools after the install. The first command shows Ruby itself and the second shows the gem package tool:
Show the installed Ruby version
ruby -v
Ubuntu 26.04.1 LTS:
ruby 3.3.8 (2025-04-09 revision b200bad6cd) [x86_64-linux-gnu]
Ubuntu 24.04:
ruby 3.2.3 (2024-01-18 revision 52bb2ac0a6) [x86_64-linux-gnu]
Show the installed gem version
gem -v
Ubuntu 26.04.1 LTS:
3.6.7
Ubuntu 24.04:
3.4.20
The two LTS releases ship different versions; both answer with a number instead of an error, which is what this lesson checks.
rbenv for newer versions
Ubuntu often ships a Ruby that is one step behind the newest release. That is fine for this course because every example works on Ruby 3.0 and newer.
When you later need the newest Ruby for a job project, look at rbenv as plain text. It installs Rubies into your home folder and lets you switch versions per project without touching system files.
Next: Install Ruby on Rocky Linux
Article author: Arthur Isaev