Install Ruby on Rails on Ubuntu Linux

Installing Ruby on Rails on Ubuntu Linux is not quite as easy as installing it on other operating systems. Here is a tutorial that will get you up and running in no time.


The most important steps in this process are to edit the repository sources file and make sure that you have all the repositories that you need.

First, open the /etc/apt/sources.list file. Find these lines, and remove the # symbol from before them:

deb http://us.archive.ubuntu.com/ubuntu dapper universe main restricted universe
deb http://security.ubuntu.com/ubuntu dapper-security universe

Next, run these commands from a Terminal window:

sudo apt-get update
sudo apt-get install ruby ri rdoc
sudo wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz
tar -xvzf rubygems-0.9.0.tgz
cd rubygems-0.9.0
sudo ruby setup.rb
sudo gem install rails –include-dependencies

The apt-get commands will install the programming language Ruby, along with a number of modules that are required for Rails. The wget command downloads RubyGems, which is the Ruby package manager similar to the built-in Ubuntu apt-get system. Finally, gems is used to install the Rails framework onto your computer.

You will now have a shiny new Ruby on Rails installation on your computer. To create a new rails project, navigate into the directory where you wish to place your application, and use this command:

rails mynewproject

The Conversation

Follow the reactions below and share your own thoughts.