Ruby is a popular, high-level programming language with a focus on simplicity. It has an elegant syntax that is to read and easy to write and is behind the powerful Ruby on Rails Framework. There are multiple ways to install Ruby on Ubuntu. The simplest is using Ubuntu’s built-in apt package manager. The version of Ruby in the Ubuntu packages manager is usually the latest stable version. In most cases, this should be good for developing apps in Ruby or using it in the Rails framework. However, if you need the latest version or a version that is not available in Ubuntu’s repositories, you will have to manually download and install it.

How to install Ruby on Ubuntu Linux

As described above, Ruby is a popular, high-level programming language with a focus on simplicity. It has an elegant syntax that is to read and easy to write and is behind the powerful Ruby on Rails Framework.

Install Ruby via Apt

Again, the easiest way to install Ruby on Ubuntu is via the apt package manager. To do that, simply run the commands below: To verify if Ruby is installed, run the commands below: It should output a similar line as below:

Install Ruby via Rbenv

Another way to install Ruby is via Rbenv. Rbenv is a tool that allows you to switch between different versions of Ruby but doesn’t allow you to install Ruby. To get Ruby, we’ll need to use ruby-build. To install Ruby-build, run the commands below to install dependencies. After that, run the commands below to clone both Rbenv and Ruby-build repositories at Github. Next, run the commands below if you’re running Bash Shell in Ubuntu. If you’re running Z Shell, run the lines below: After the steps above, you can install any available version of Ruby. To list the available versions, run the commands below: Then install the version you want by using the commands below. For this post, we’re installing Ruby 2.5.1. Replace the version number with the correct one that suits your environment. To verify the Ruby version, run the commands below: It should output a similar line as below:

Install Ruby via RVM

RVM is another tool for installing and managing Ruby on Linux systems, including Ubuntu. To install RVM and use it to get Ruby, follow the steps below: First, install dependencies by running the commands below: Then run the commands below to install RVM. After that, run the command below to activate RVM To install Ruby, run the commands below: To verify if Ruby is installed, run the commands below: It should output a similar line as below: Conclusion: These are the many ways to install Ruby on Ubuntu. If you find errors in the steps above, please let us know by commenting in the form below.