×


Install Ruby on Ubuntu 20.04 - Step by Step Process ?

Ruby is an open-source, object-oriented, and general-purpose programming language which is one of the most popular programming languages.

Ruby programming language is the reason behind the powerful Ruby and Rails framework.

It also supports functional and object-oriented programming.

Ruby and Ruby on Rails differ from each other in a sense that the former one is a general-purpose programming language whereas the latter one is a web-based framework. 

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Ruby related queries.

In this context, we shall look into how to install Ruby on a Ubuntu 20.04 system.


How to install Ruby on Ubuntu 20.04 ?

To install the latest available and compatible version of Ruby on your Ubuntu 20.04 system, following steps should be performed.

Then follow the steps given below.


1. Perform Ubuntu 20.04 System Cache's Update

We need to update our Ubuntu 20.04 system's cache by executing the command shown below:

$ sudo apt-get update

This command will get the system updated successfully.


2. Install the Latest Compatible Version of Ruby on your Ubuntu 20.04 System

Now, we need to install the latest available and compatible version of Ruby on our Ubuntu 20.04 system with the command shown below:

$ sudo apt install ruby-full


3. Verify the Successful Installation of Ruby on your Ubuntu 20.04 System

You can even verify the successful installation of Ruby on your Ubuntu 20.04 system by checking its version with the command shown below:

$ ruby --version

This will display the version of Ruby installed on Ubuntu system.


How to uninstall Ruby from Ubuntu 20.04 ?

To remove Ruby from your Ubuntu 20.04 system, you have to execute the command shown below:

$ sudo apt-get purge ruby

This command will remove Ruby and its configuration files from your Ubuntu 20.04 system.

Now, you can also remove the irrelevant packages and dependencies from your Ubuntu 20.04 system for freeing up the occupied space with the command shown below:

$ sudo apt-get autoremove

Running this command will free up a significant amount of your Ubuntu 20.04 system's space.


[Need urgent assistance in fixing Ruby related issues? We can help you. ]


Conclusion

This article covers the method of installing Ruby on a Ubuntu 20.04 system.

Also, if you want to remove this programming language from your Ubuntu 20.04 system, then you can also do this by the method that we mentioned in this guide.


To Update RubyGem Package Manager:

RubyGems is a Ruby Package Manager, coming with the gem command-line tool. It's automatically installed when we install Ruby on the system.

To update the RubyGem to the latest version, run the following command.

$ gem update --system


How To Install Ruby on Rails on Ubuntu ?

Here, we will install the latest version of Ruby on Rails through the RubyGem package manager.

Install Ruby on Rails using the gem command below:

$ gem install rails

Once all installation is completed, check the Ruby on Rails version:

$ rails --version


To Install and Configure PostgreSQL on Ubuntu System:

1. Install the PostgreSQL database server to the Ubuntu 20.04 using the apt command below:

$ sudo apt install postgresql postgresql-contrib libpq-dev -y

2. Once all installation is completed, start the PostgreSQL service and add it to the system boot:

$ systemctl start postgresql
$ systemctl enable postgresql