Tutorial

How To Install Ruby on Rails on Ubuntu 12.04 LTS (Precise Pangolin) with RVM

Published on May 25, 2012
How To Install Ruby on Rails on Ubuntu 12.04 LTS (Precise Pangolin) with RVM
Not using Ubuntu 12.04?Choose a different version or distribution.
Ubuntu 12.04

This tutorial is out of date and no longer maintained.

Status: Deprecated

This article covers a version of Ubuntu that is no longer supported. If you are currently operate a server running Ubuntu 12.04, we highly recommend upgrading or migrating to a supported version of Ubuntu:

Reason: Ubuntu 12.04 reached end of life (EOL) on April 28, 2017 and no longer receives security patches or updates. This guide is no longer maintained.

See Instead:
This guide might still be useful as a reference, but may not work on other Ubuntu releases. If available, we strongly recommend using a guide written for the version of Ubuntu you are using. You can use the search functionality at the top of the page to find a more recent version.

About Ruby on Rails

Ruby on Rails is an application stack that provides developers with a framework to quickly create a variety of web applications. Ruby on Rails does take a little while to install on a virtual server, but luckily there are a lot of helpful tools to make this process as easy as possible. You can run this tutorial on your droplet as a user with sudo privileges. You can check out how to set that up here: Ubuntu Server Setup

Step One— Install Ruby with RVM

Before we do anything else, we should run a quick update to make sure that all of the packages we download to our VPS are up to date:

sudo apt-get update

Once that's done, we can start installing RVM, Ruby Version Manager. This is a great program that lets you use several versions of Ruby on one server; however, in this case, we will just use it to install the latest version of Ruby on the droplet.

If you do not have curl on your system, you can start by installing it:

sudo apt-get install curl

To install RVM, open terminal and type in this command:

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

After it is done installing, load RVM. You may first need to exit out of your shell session and start up a new one.

source ~/.rvm/scripts/rvm

In order to work, RVM has some of its own dependancies that need to be installed. To automatically install them:

rvm requirements

You may need to enter your root password to allow the installation of these dependencies.

On occasion the zlib package may be reported as missing. The RVM page describes the issue and the solution in greater detail here.

Step Two—Install Ruby

Once you are using RVM, installing Ruby is easy.

rvm install ruby

The latest ruby is now installed. However, since we accessed it through a program that has a variety of Ruby versions, we need to tell the system to use the version we just installed by default.

rvm use ruby --default

Step Three—Install RubyGems

The next step makes sure that we have all the required components of Ruby on Rails. We can continue to use RVM to install gems; type this line into terminal.

 rvm rubygems current

Step Four—Install Rails

Once everything is set up, it is time to install Rails. To start, open terminal and type in:

gem install rails

This process may take a while, be patient with it. Once it finishes you will have Ruby on Rails installed on your droplet.

See More

Once you have installed Ruby on Rails on your server, you can proceed to Create a SSL Certificate for your site or Install an FTP server

By Etel Sverdlov

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the authors

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
10 Comments


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

I want to install RVM in ubuntu and i am folling these steps

root@jaskaran-Vostro-1550:/home/user_name# sudo apt-get install curl

done this successfully

root@jaskaran-Vostro-1550:/home/user_name# curl -L https://get.rvm.io | bash -s stable

done this successfully

but when i run this command

root@jaskaran-Vostro-1550:/home/user_name# source ~/.rvm/scripts/rvm

result like that

bash: /root/.rvm/scripts/rvm: No such file or directory

what wrong in this

A friend got an error about a public key not being found with the command

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

This one from rmv.io solved it

gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

Great tuto and thanks!

For those of you having trouble with this step: source ~/.rvm/scripts/rvm

no such file or directory found

and you were not signed in as root, then most likely you got something like this during your curl command: gpg: Can’t check signature: public key not found

run the following command: gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

as per: http://stackoverflow.com/a/28584326/4260179

source ~/.rvm/scripts/rvm should work now!

This tutorial has stood the test of time! I was able to get things up-and-running in a vagrant box using it with one addition:

gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

Is required before you get cURLing. Thanks for writing this up!

hello all while installing RVM , I stuck here Error running 'requirements_debian_libs_install gawk

You must read this tutorial on Buffercode and add solution for these errors .

Etel, you really know how to write tutorials! Thank you very much!

Be aware , the step

gem install rails

can take forever, because of ri documentation install So if you are not developer and docs are not needed within a server - use

gem install rails --no-rdoc --no-ri

command, that is much faster

really cool!thanks

please add --no-ru --no-rdoc on gem install rails it takes at least 10 time longer otherwise

gem install rails --no-ri --no-rdoc

Regarding this error: mkdir: cannot create directory `/usr/local/rvm/log/ruby-2.0.0-p195’: Permission denied

I fixed it by adding the ‘rvm’ group to my user.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.