Installing Ruby 1.9, Ruby 3 and Passenger on Debian Lenny or Squeeze

The following is how i got a Ruby on Rails app running on Debian Lenny.

First edit your apt sources list to add Squeeze backports to get a stable Rails

apt-get install ruby1.9.1-full gem1.9.1 install rails gem1.9.1 install rubygems-update gem1.9.1 install rake

These commands will install the ruby libaries in /var/lib/gems/1.9.1/.  You can now to deploy the Ruby on Rails app to the web server. You may need a few development pacakage for mysql, xml and xslt, so you may need to install the following.

apt-get install libxml2-dev  libxslt1-dev libmysqlclient-dev

Once this is complete change to the directory and run /var/lib/gems/1.9.1/bin/bundle install

This will install all the required Gems for the application.

Now we need to install passenger.

gem1.9.1 install passenger

If you use Apache, you will then need the passenger apache module.  This requires a number of development libraries, that might not be installed.  They can be installed using: apt-get install build-essential libssl-dev zlib1g-dev apache2-prefork-dev libapr1-dev libaprutil1-dev libcurl4-openssl-dev

Once that is complete run the following: /var/lib/gems/1.9.1/bin/passenger-install-apache2-module

vi /etc/apache2/mods-available/passenger.load a2enmod passenger /etc/init.d/apache restart