Linux Mint

How to Install Ruby on Linux Mint 21

Ruby is an efficient, simple, and popular interpreted scripting language designed specifically to develop frontend, backend web applications. Not only web applications, Ruby is also famous among developers for creating automation tools, web scraping and crawling, DevOps, and data processing.

Install Ruby on Linux Mint 21

There are several ways to install Ruby on Linux Mint 21 system but we have picked the simplest ones that do not create any hurdles while performing:

1: Using APT

2: Using rbenv Tool

3: Using Snap

1: Install Ruby using APT

We can directly install Ruby from the apt repository, for this upgrade the system packages repositories using the command:

$ sudo apt update

Now, install Ruby, executing:

$ sudo apt install ruby-full

Run the version command:

$ ruby --version

2: Install Ruby Using rbenv Tool

It is a light-weighted and simple tool that is used to install different versions of Ruby.

To install Ruby on Linux Mint 21 system using rbenv utility, follow the steps carefully listed below:

Step 1: Update the system to let all the packages up-to-date using the command:

$ sudo apt update

Step 2: In the next step, you need to download all the required prerequisites:

$ sudo apt install git curl autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zliblg-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev

Step 3: Now download and run the shell script, executing:

$ curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash

Step 4: After installing shell script, now create a path to run rbenv environment, type in terminal:

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc

echo 'eval "$(rbenv init -)"' >> ~/.bashrc

source ~/.bashrc

Step 5: Verify the installation of rbenv tool in the Linux Mint 21 system by making use of the following command:

$ rbenv -v

Step 6: Execute the mentioned command to display all the possible versions of Ruby that can be installed using rbenv tool:

$ rbenv install -l

Step 7: After the successful completion of each step, we have mentioned above, now, you can get Ruby on Linux Mint 21. If we want to install the Ruby 3.0.2 version then use:

$ rbenv install 3.0.2

Step 8: To confirm the Ruby installation, type in terminal:

$ ruby --version

3: Install Ruby Using Snap

You can also install Ruby via snap, for this use the command mentioned below:

$ sudo snap install ruby --classic

But make sure snapd is installed on your system before installing Ruby through snap packages; read how to enable snap on Linux Mint. You can also uninstall it through the following command:

$ sudo snap remove ruby --classic

Conclusion

Ruby is popular object-oriented programming used to create small to large web frameworks and applications. Not only web applications, but Ruby is also famous among developers for creating automation tools, web scraping and crawling, DevOps, and data processing. This guide has demonstrated a brief explanation of how we can get Ruby on our Linux Mint 21 system. We have mentioned the three easiest ways from the several methods to let it install on the system.

About the author

Syeda Wardah Batool

I am a Software Engineer Graduate and Self Motivated Linux writer. I also love to read latest Linux books. Moreover, in my free time, i love to read books on Personal development.