Step 1 – Prerequisites

Login to your Debian system using GUI or use ssh for remote hosts. Then install some pre-required packages.

Step 2 – Install RVM

Before installing RVM first we need to import public key in our system then use curl to install rvm in our system. After installing RVM first we need to set up rvm environment using below command. so that current shell takes new environment settings. After this, install all the dependencies for installing Ruby automatically on the system. Run below command on terminal.

Step 3 – List Available Ruby Versions

Get a list of available versions of Ruby language. You can install any version of your choice or requirements showing on the list.

Step 4 - Install Ruby on Debian

RVM is useful for installation of multiple Ruby versions on the single system. Use the following command to install required Ruby on your system. As shown below example will install Ruby 2.6 on Debian system. [Sample Output]

Step 5 - Setup Default Ruby Version

Use rvm command to set up default ruby version to be used by applications. You can install multiple versions as defined in the above step. Now select which version you want to use.

Step 6 - Check Ruby Version

Using following command you can check the current ruby version is used.

Step 7 - Install Rails

You can install the latest stable release version of Rails by running the following command. It will install Rails in global gemset So that all applications share the same version of Rails. Or we can get a specific version of Rails by defining –version during installation. Visit here to get available rails versions. Congratulation’s, You have successfully installed Ruby on your system. Read our next articles to deploy Ruby with Apache or Ruby with Nginx web server with simple steps.