Ruby is one of those programming languages that may be a little underestimated. However, it is a robust, multipurpose, open-source language that stands out for its efficiency in coding applications. So, in this post, you will learn how to install Ruby on Ubuntu 20.04 / Debian 10.
According to the project’s own website, RVM (Ruby version manager), RVM is a command-line tool that allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems. In short, with this tool, you can easily install different versions of Ruby on any system.
By using RVM, you have the main advantage of being able to install the latest stable version of the language. As mentioned earlier, we can install different versions of Ruby.
Install Ruby on Ubuntu 20.04 / Debian 10
So the first thing we have to do is open a terminal and install some necessary packages before starting the installation.
:~$ sudo apt install gnupg curl
As you can see, these packages include curl which will be in charge of downloading RVM.
To do this, run this command which will download RVM and then run it.
:~$ curl -sSL https://get.rvm.io | bash
Then make RVM available as a command by refreshing the user profile.
:~$ source /home/angelo/.rvm/scripts/rvm
To prove that everything went well, just show the version of RVM installed.
:~$ rvm -v rvm 1.29.10-next (master) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
Now we can show you all the versions of Ruby available for installation.
:~$ rvm list known
As you can see, there are several. However, at the time of writing this post, the last available stable version is 2.7.1 so we’ll install it:
:~$ rvm install ruby-2.7.1
RVM can handle several versions of Ruby on one system. So we need to set which one will be the major version.
:~$ rvm --default use ruby-2.7.1
Then, display the version of Ruby with the following command:
:~$ ruby -v
In this case, Ruby is already installed and ready to start work.
If you ever want to uninstall it, just run the following command:
:~$ rvm remove ruby-2.7.1
This completes the whole process. So, enjoy it.
Ruby is a pretty powerful language. It seems to be given little credit, but it is still widely used and large server applications, as well as scripts, are developed with this language.
Please share this post and join our Telegram channel.