Installing Ruby On Rails On Ubuntu on Azure

I have a customer wanting to run their Rails stack on Azure. So I thought I'd explore what it takes to make that happen.

Ruby on Rails is an application stack that provides developers with a framework to quickly create a variety of web applications.

Starting at the Azure Portal

The first step is to provision a VM in an Azure Data Center. You can automate this using PowerShell, Shell Script, JavaScript and more. But let's do it the easy, quick way - let's just click a few buttons on the portal.

Once you've logged then you simply navigate to the left menu bar and choose Virtual Machines. And in the lower left corner you can see the +NEW command.


Figure 1: Creating your Ruby VM at the portal

Notice that you can choose version 14.1 of Ubuntu.


Figure 2: Choosing Ubuntu

In the next step you will name your VM. You will also need to provide a username and password.


Figure 3: Naming your virtual machine

The next screen is about specifying a cloud service that will act as a container to map incoming requests to the VM. We'll keep things simple for the moment and ignore some of these details. There is a lot of other tutorials and web properties that explain all that.


Figure 4: Providing a location/data center for your virtual machine


Figure 5: The Azure portal showing the our virtual machine is running

Remoting into Ubuntu

The next step is about remoting in and installing software.


Figure 6: Remoting into our virtual machine

Because of the way we named our VM, here is the url to remote in:

We can remote in with Putty, as seen in the figure below.


Figure 7: Logged in and ready to start installing Ruby

After logging in, your session should look like this:


Figure 8: Getting to a Ruby command prompt

Adding Ruby

The next few steps are about installing Ruby. The first is to get CURL installed. cURL is a computer software project providing a library and command-line tool for transferring data using various protocols. It will be used to install RVM, the Ruby Version Manager. But RVM requires Gnu Privacy Guard, providing a way to verify signed binaries so you don't install bogus software.

Installing Ruby Part 1
sudo apt-get update
sudo apt-get install curl

You will need to answer "Y" to move through these steps.

Installing Ruby Part 2
1 gpg --keyserver hkp:[###1###]

The next few steps are quite simple. They use the Ruby version manager to get the latest copy on to our Ubuntu server. Curl is the tool that lets us accomplish some of this.

Installing Ruby
\curl -L https:[###1###]
source ~/.rvm/scripts/rvm
rvm requirements
rvm install ruby
rvm use ruby --default
rvm rubygems current
gem install rails

At this point you are ready to start. You can bring up the Ruby command prompt with irb.


Figure 9: Hello world in Ruby

Hello world and Ruby is amazingly easy. You just type then hello world inside of quotes. No print command is needed.


At this stage we are done configuring Ruby. Perhaps the next post will take this a little step further and show what else can be done with Ruby.

There is a Ruby development Center where you can download the Azure SDK for Ruby:

Skip to main content