This tutorial will help your to install required Ruby version on your Ubuntu 20.04 system. If your application release on Ruby 1.9 or 1.8 versions, We recommended to go with previous Ubuntu version.

Pre-Requisites

You must have shell access with sudo privileged account to your Ubuntu 20.04 system. Now, Use one of the below 2 methods for installing Ruby languege on your system. We prefer to use Method 2 to install Ruby with RVM on Ubuntu 20.04 system.

Method 1 – Install Ruby from Default Repositories

The Ubuntu 20.04 official repositories contains the latest version of Ruby (ie. 2.7). Users need to start building application with Ruby 2.7.0 or existing applications’s supported 2.7 can install directly on their systems. To install Ruby 2.7 on your Ubuntu system, Login to your system with sudo privileged account and execute the following commands: After the installation completed. Check the installed Ruby version by executing command: Output will be something like below. Next, method will help you for installing Ruby using RVM on Ubuntu system.

Method 2 – Installing Ruby with RVM

RVM is known as Ruby Version Manager is a command-line tool for the installing and managing multiple Ruby versions on a single system. This tutorial will help you to install RVM on your Ubuntu system. Also install required or multiple Ruby versions and switch between them. First, update the Apt cache and install few basic required packages: Now, Run the following commands to add the GPG key to your Ubuntu system. The second command will install latest RVM tool your Ubuntu system. After installation, set and load the RVM environment variables to current session. Then install all the required packages dependencies for RVM on your system. Output: Now, find out the available Ruby version’s for your System. To get a list of all Ruby versions that can be installed with RVM, type: You will see a list of Ruby packages along with plugins supported specific integrations. Now, install the required Ruby version by running one of the following command. To install a different version, you must pass version number to the following command: The above command will also set Ruby version as default version your installed. Once the installation completed. Check the current default Ruby version by executing following command. If the current default Ruby version is not suitable for you. You can change the default version by executing command as below. Make sure to change the Ruby version as per your requirements.

Conclusion

In this tutorial, you have learned to install Ruby programming language on your Ubuntu 20.04 system.