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 *



ServerName
ServerAlias

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.

Reference:
http://www.rubyhead.com/2008/04/25/installing-ruby-rails-on-ubuntu-804-hardy-heron/

6 comments:

M@ said...

thanks for posting this. Is there any reason when I try to run gem after running ruby setup.rb that it looks at /usr/bin/gem instead of the one in the bin folder I just set up - ~/rubygems-1.2.0/bin?

M@ said...

I managed to cd into the bin directory of the dir I created and ran sudo ./gem install rails --version 2.0.2

and it's okay, but can yuo tell me how I can associate it so I dont have to be in that directory to run gem?

Mugunth said...

Hi M@,

Thanks for your feedback.

I missed one step, after installing rubygems, you need to create a symlink /usr/bin/gem to point to the installed gem directory.

You can use the following command.
$ sudo ln -s /usr/bin/gem1.8 /usr/bin/gem


Also one more typo error in my entry:

=============
7.Deploy redmine application
Download redmine and copy redmine folder inside web folders /etc/www/
============
in this instead of" /etc/www " it should be "/var/www "

I have just edited my blog to correct the above changes.

thanks again for your feedback.

David said...

Also, if you see redmine running but no stylesheet being applied (i.e. an ugly white screen), it probably means you don't have mod_rewrite enabled!

Simply go to /etc/apache2/mods-enabled and softlink using "ln -s ../mods-available/rewrite.load"and then restart apache.

Anonymous said...

If you run into '/tmp/mysql.sock' missing file while installing DB tables, remember to install Ruby db wrapper for MySQL:
apt-get install libmysql-ruby.

After this DB installation is a breeze ...

Anonymous said...

Who knows where to download XRumer 5.0 Palladium?
Help, please. All recommend this program to effectively advertise on the Internet, this is the best program!