Ruby on Rails
RailsOnDebianStable

Ruby on Rails is not a part of the Debian stable (sarge) distribution, but is included in debian etch. For sarge, it only exists in testing and unstable. There are two ways to work around this.

  1. the complete debian way is adding debian testing apt sources to your system so Ruby on Rails debian packages can be installed. ( Note that your system
    won’t become unstable, only Ruby on Rails and its dependencies will be
    updated to testing packages )
  2. using RubyGems to install the Ruby on Rails

Both options have advantages and disadvantages.

The good news for the debian way is that Ruby on Rails will be updated with the rest of the distribution and can be cleanly uninstalled and purged.

The bad news for the debian way is that you are able to install unstable packages now so you have to read carefully all the messages provided by apt when you install a new package ( you already do that, I’m sure! ;-) )

You can install apt-listbugs so apt will notify you of any known bugs in the packages you want to update or install.

The bad news with the RubyGems way is that you have to maintain Ruby on Rails by yourself.

The good news is that you can’t install debian unstable packages so you don’t have to read apt messages anymore ;-).

In both cases, you have to be logged as root

The debian way

Add testing packages to your source list

experienced debian users can edit the /etc/apt/sources.list, others should use apt-setup.

Keep your debian stable very important

Add this line to your /etc/apt/apt.conf


APT::Default-Release "stable";

(create the file if it doesn’t exists)

Update and upgrade


aptitude update && aptitude upgrade

Install

Ruby on Rails

Rails depends on the testing version of rake:


aptitude install rake/testing rails

apt-listbugs ( optional )


aptitude install apt-listbugs

Using RubyGems.

Getting all of ruby

Ruby 1.8.2 is now included with debian stable (sarge)

Become root, and update apt-get for the latest listings:

 apt-get update

Then install the following packages as necessary:


% apt-get install ruby irb rdoc libopenssl-ruby1.8 % ruby -v ruby 1.8.2 (2005-04-11) [i386-linux] (or newer)

Install ruby gems

This is reasonably straightforward and documented on the Gems site:

Be sure to check rubyforge.org for the current version of rubygems and use that in place of the package listed below.


% wget rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz
% tar xzvf rubygems-0.8.11.tgz
% cd rubygems-0.8.11
% ruby setup.rb

Note if you using rails 1.2 and above, you need the newer version of the rails gem. You can use the following


wget rubyforge.org/frs/download.php/17190/rubygems-0.9.2.tgz

(Those concerned about package management hygiene may prefer to install RubyGems under /usr/local – go to HowToInstallRubyGemsUnderUsrLocalOnLinux and then return here.)

Install rails

Given a working version of ruby 1.8, mod_ruby and gems, this was simple:


% gem install rails --include-dependencies

Now, finally you should be able to run the Rails Tutorial… good luck!

Extensions

fastcgi

You need ruby-dev for compiling ruby extensions. read the next bit before you run this


% apt-get install ruby-dev
% apt-get install libfcgi-dev
% gem install fcgi


If you are running Sarge, you need to get ruby1.8-dev instead of ruby-dev.

A note for those running stable (where stable == sarge)


% apt-get install ruby-dev

  1. suggests you get ruby1.6-dev
  2. this is bad, as it will go get ruby1.6, but you want ruby1.8
    % aptitude install ruby-dev
  3. says “No candidate version found for ruby-dev”
    % apt-get install ruby1.8-dev
  4. works. I think this is what you want.
  5. now go back and do the libfcgi-dev and fcgi lines

see also these notes

Mysql


% apt-get install libmysqlclient10-dev
% gem install mysql

I also found this tutorial pretty helpful.

http://brainspl.at/rails_stack.html

Apache2 proxying to Lighttpd

I wrote a tutorial and collected some links here