Tuesday, July 08, 2008

Steps to deploy redmine application in ubuntu 8.04 using mod_rails(passenger).

Redmine is my favourite project management tool written in ruby on rails. Recently I deployed this i a Ubuntu 8.04 machine using Apache2 + mod_rails. Mod_rails is a apache module which has made rails deployment as easy as php deployment. You can find more details about mod_rails here: http://www.modrails.com
I was able to install mod_rails and deploy redmine after doing some googling and trial & Errors

Here are the steps for deploying redmine using modrails in ubuntu 8.04:

1. Intalled Ruby language, build essential(to build gems later) and related dependent components using apt-get.

$ sudo apt-get install ruby irb ri rdoc ruby1.8-dev libzlib-ruby libyaml-ruby libreadline-ruby libncurses-ruby libcurses-ruby libruby libruby-extras libfcgi-ruby1.8 build-essential libopenssl-ruby libdbm-ruby libdbi-ruby libdbd-sqlite3-ruby sqlite3 libsqlite3-dev libsqlite3-ruby libxml-ruby libxml2-dev

2. Downloaded ruby gems:
$ wget http://rubyforge.org/frs/download.php/38646/rubygems-1.2.0.tgz

3. untared the rubygems-1.2.0.tgz package and installed rubygems.
$ tar -xvf rubygems-1.2.0.tgz
$ cd rubygems-1.2.0/
$ ruby setup.rb
$ sudo ln -s /usr/bin/gem1.8 /usr/bin/gem (use this if /usr/bin/gem link is not created)

4. Installed rails version 2.0.2 using gems. As of now Redmine works only on rails version 2.0.2 (it wont work in rails 2.1.x)
$ gem install rails --version 2.0.2

5. Install mod_rails(passenger). mod_rails is called as Phusion Passenger and the gem package name is passenger. Lets refer to it as passenger hereafter.
Mod_rails requires apache2-threaded-dev apache module to be installed.
$ apt-get install apache2-threaded-dev

$ gem install passenger

6. Install passenger as apache module
$ passenger-install-apache2-module

7.Deploy redmine application
Download redmine and copy redmine folder inside web folders /var/www/
else there will be problem in showing css files and images.
redmine should be in this folder /var/www/redmine
create the database and modify the config files as mentioned in the redmine install document.

8.Apache2 configuration changes:
$ cd /etc/apache2/sites-available/
$ sudo mv default default.bkp

Create a new default file with the following contents.
NameVirtualHost *


DocumentRoot /var/www/redmine/public

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

ErrorLog /var/log/apache2/error.log

LogLevel warn

CustomLog /var/log/apache2/access.log combined
ServerSignature On


9. Restart apache
$ sudo /etc/init.d/apache2 restart

10. Browse http://localhost , redmine should show up in the browser.