How to Install Ruby on Linux

Here’s how you can set up a development environment on your Linux machine by installing Ruby.

Ruby is a powerful and dynamic object-oriented programming language widely used for web development, system administration, and other software applications.

To get started with developing Ruby apps, you’ll have to first download Ruby and its dependencies on your computer. Let’s learn how you can install and set up a Ruby development environment on Linux.

Prerequisites to Installing Ruby

Before you move on to the installation process, make sure to update and upgrade your system. You can do so using the following commands:

On Ubuntu- and Debian-based Linux distros:

 sudo apt update && apt upgrade -y 

On Arch Linux and its derivatives:

 sudo pacman -Syu 

On RHEL and Fedora:

 sudo dnf update && dnf upgrade 

Once you’ve updated and upgraded your system, you’re ready to move on to the next steps.

How to Install Ruby on Linux

You can install Ruby via your distro’s default package manager or by manually building from the source. It’s recommended that you opt for the first option as it’s neater and more organized than the manual method.

Here’s how you can install Ruby on Linux:

On Ubuntu/Debian derivatives:

 sudo apt install ruby 

On Arch Linux-based distributions:

 sudo pacman -S ruby 

On RHEL, Fedora, and CentOS:

 sudo dnf install ruby

Check the Ruby Version Installed on Linux

Now you may want to verify your Ruby installation. You can quickly do that by firing up a terminal and typing in the command to check the version of Ruby currently installed on your system:

 ruby -v 

To get help with the ruby command, you can type ruby in the terminal with the -h flag or read its manual page using the man command. To get a better grasp of all the features and capabilities that Ruby brings to the table, it’s recommended that you check out the official Ruby documentation.

How to Uninstall Ruby From Your Linux System

You can easily uninstall Ruby from Linux using the package manager you installed it with. Here are the commands to uninstall Ruby:

On Ubuntu/Debian derivatives:

 sudo apt purge ruby 

On Arch Linux-based distributions:

 sudo pacman -R ruby 

On RHEL, Fedora, and CentOS:

 sudo dnf remove ruby 

Now You Can Build Software With Ruby on Linux

Writing good code depends on the programmer and not the programming language. As a beginner, you might be writing “bad” code without even realizing it. It’s better to catch on to bad habits early to prevent embarrassment or worse, performance or security issues later.

You really don’t want to showcase spaghetti code on your portfolio when applying for entry-level roles. Make sure you’re following the best coding practices from the get-go as you embark on your development journey.


🧪 |Medical Laboratory Scientist 🥇 | Mindset over Everything. 
 🤝 | Let's Grow Together.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button