Ruby is a strong and dynamic object-oriented programming language extensively used in web development, system management, and other software apps. To build Ruby apps, you must first install Ruby and its dependencies on your computer. So first, let’s look at how to install and configure a Ruby development environment on Linux.
Installing Ruby Prerequisites
Ensure to update and upgrade your system before moving on to the installation procedure. You can accomplish so by using the commands listed below.
On the Ubuntu- and Debian-based Linux distros.
sudo apt update && apt upgrade -y
On the Arch Linux and its derivatives.
sudo pacman -Syu
On the RHEL and Fedora.
sudo dnf update && dnf upgrade
After you’ve updated and upgraded your system, you’re ready to move on to the next stage.
Guide On How To Install Ruby On Linux?
You may install Ruby via your distro’s default package manager or manually build from the source. The first option is recommended since it is neater and more organized than the manual technique.
This is how you install Ruby on Linux.
On Ubuntu/Debian derivatives.
sudo apt install ruby
On the Arch Linux-based distributions.
sudo pacman -S ruby
On the RHEL, Fedora, and CentOS.
sudo dnf install ruby
Check Ruby Version Installed On Linux
You should now test your Ruby installation. You may do this fast by opening a terminal and using the command to check the version of Ruby currently installed on the system.
ruby -v
To receive assistance with the ruby command, use the -h flag in the terminal or read its manual page using the man command. You should check out the official Ruby documentation to better understand all the features and capabilities that Ruby brings to the table.
How To Uninstall Ruby From Linux System?
Ruby may be uninstalled from Linux by using the package manager used to install it. The commands to uninstall Ruby are as follows.
On the Ubuntu/Debian derivatives.
sudo apt purge ruby
On the Arch Linux-based distributions.
sudo pacman -R ruby
On the RHEL, Fedora, and CentOS.
sudo dnf remove ruby
The Bottom Line:
Writing good code is determined by the programmer rather than the programming language. You may create “bad” code as a newbie without recognizing it. Developing negative habits early on is preferable to avoid humiliation or, worse, performance or security difficulties later on. When applying for entry-level positions, you want to avoid showing off the spaghetti code in your portfolio. As you begin your development journey, be sure you’re following the best coding standards.