This page is obsolete: please look at RailsOnUbuntuDebianTestingAndUnstable instead.
The following instructions tell you to run commands as root on your computer. As always, don’t run things as root before you think about them, especially commands that come from a wiki that can be edited by anonymous people.
Become root, and paste the following command to install the necessary packages:
apt-get update
Now continue with one of the “Installing…” sections below depending on whether you are running Debian Unstable, Testing, Woody or Ubuntu Warty or Hoary.
apt-get install rails
And you’re done.
apt-get install \
irb1.8 \
libdbm-ruby1.8 \
libgdbm-ruby1.8 \
libopenssl-ruby1.8 \
libreadline-ruby1.8 \
libruby1.8 \
libruby1.8-dbg \
rdoc1.8 \
ri1.8 \
ruby \
ruby1.8 \
ruby1.8-dev \
libmysql-ruby1.8 \
ruby1.8-examples
Continue in the section “Common procedure for Testing and Ubuntu”.
sudo apt-get install \
irb1.8 \
libbigdecimal-ruby1.8 \
libcurses-ruby1.8 \
libdbm-ruby1.8 \
libdl-ruby1.8 \
libdrb-ruby1.8 \
liberb-ruby1.8 \
libgdbm-ruby1.8 \
libiconv-ruby1.8 \
libopenssl-ruby1.8 \
libpty-ruby1.8 \
libracc-runtime-ruby1.8 \
libreadline-ruby1.8 \
librexml-ruby1.8 \
libruby1.8 \
libruby1.8-dbg \
libsdbm-ruby1.8 \
libsoap-ruby1.8 \
libstrscan-ruby1.8 \
libsyslog-ruby1.8 \
libtest-unit-ruby1.8 \
libwebrick-ruby1.8 \
libxmlrpc-ruby1.8 \
libyaml-ruby1.8 \
libzlib-ruby1.8 \
rdoc1.8 \
ri1.8 \
ruby \
ruby1.8 \
ruby1.8-dev \
libmysql-ruby1.8 \
ruby1.8-examples
(You don’t need to do this if you’re running Debian Unstable)
Download the rubygems package installer, used to install “gems” (ruby packages), from http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz
Extract rubygems:
tar zxvf rubygems-0.8.11.tgz
Set up rubygems:
cd rubygems-0.8.11
sudo ruby1.8 setup.rb
Use the rubygem installer to re-install itself. This will get you the latest revision:
sudo gem install rubygems-update
OK, now you can install gems for other software. Run this command to install rails:
sudo gem install rails
Answer “y” to all of the requests to install dependencies.
Once this completes, you should have a “rails” command. Test it:
cd ~
rails Test
cd Test
script/generate controller test
script/server &
Open your web browser to http://localhost:3000/
You should see a “congratulations” page.
Please email bruce at perens dot com and tell him if these instructions worked, what Debian system you are using (unstable, testing, ubuntu hoary, etc.) and any other comments. Thanks! – BrucePerens
Q: How do I install the sqlite db drivers?
Note to the anonymous person who changed these commands to use wajig. Please don’t do that again. It’s not standard equipment on Debian.
The custom-require problem seems to be resolved. – Bruce
Q: Is this the recommended way to install rails, and not apt-get install rails?
The recommended way definitely is via apt-get install rails. In fact, that’s the main reason for using a Debian based linux distribution — it will manage stuff like that for you. On Debian Sarge, apt-get install rails just doesn’t work at the moment. However it is allready available in Debian Unstable.
FWIW, this worked fine for me on Ubuntu Hoary.
Q: Why do I just see the contents of dispatch.fcgi when using mod_fcgid with the default rails setup?
Change
\AddHandler fastcgi-script .fcgi
to
\AddHandler fcgid-script .fcgi
in /public/.htaccess.
*Q: How can I get around the 1.8.2 version check?
Ubuntu hoary has version 1.8.1 in it, which has security problems. If you have the security updates repository installed, you will have 1.8.2pre4 which solves this problem. However, the date associated with the version is 2004-12-23, but rails really wants 2004-12-25.
You’ll get a message like this:
Rails requires Ruby version 1.8.2 (2004-12-25) or later.
You're running 1.8.2 (2004-12-23); please upgrade to continue.
This can be worked around:
edit /usr/lib/ruby/gems/1.8/gems/rails-0.13.1/bin/rails change 'min_release = "1.8.2 (2004-12-25)"' to 'min_release = "1.8.2 (2004-12-23)"'
and rails should run.