How to install Ruby

In this article you will learn how to install Ruby on Rails (ROR) under Linux / UNIX environments.

What is Ruby on Rails?

Ruby on Rails is a web application development stack that provides developers with a framework to quickly create a variety of web applications. Ruby on Rails is very hot in market, especially if you are looking for developing scalable, flexible and applications for SaaS (Software as a service) applications.

Before we begin our installation of Ruby on Rails on our Debian based operating system Ubuntu 12.04 LTS, you need to make sure that your hostname is correctly setup.

If you don’t know on how to set your machine hostname, please refer to our previous article “How to set the hostname of a machine”

In our case, our hostname is “example.com”

First, we update our operating system’s repositories and then upgraded the packages installed.

Please note we are running all commands from a sudo enabled user.

sudo apt-get update

sudo apt-get upgrade

Once the update and upgrade process is done we will install RVM. It is known as “Ruby Version Manager.” This enables you to run multiple versions of ruby under one server. It’s a great program and gives you the flexibility to run multiple versions which may be required if we are using any specific framework version application.

We need to install “curl” on this machine, which will be required later.

sudo apt-get install curl

Now, install RVM (Ruby Version Manager) by using the below command:

sudo curl -L https://get.rvm.io | bash -s stable

Above download the bash script and install. After the installation is complete you need to close your shell sessions and start a new one.

source ~/.rvm/scripts/rvm

To make everything work, RVM has some of its own dependencies that needs to be installed which we can see by using the command below:

Now, you need to follow the instructions that were given by executing “rvm requirements” command. In our case, we got the above output so we will simply copy the suggested copy and install the packages required to make it work.