HowTo Install Redmine on Debian with Ruby-on-Rails and Apache2 Passenger

A .bash_history based Doc.

aptitude install ruby libzlib-ruby rdoc irb

NOTE: The rubygems from repository is not working. We download gems from sourceforge

cd /tmp
wget http://rubyforge.org/frs/download.php/70697/rubygems-1.3.7.zip
unzip rubygems-1.3.7.zip
cd rubygems-1.3.7
ruby setup.rb all
cd ..
rm -r rubygems-1.3.7 rubygems-1.3.7.zip
ln /usr/bin/gem1.8 /usr/bin/gem

gem install rails --include-dependencies
gem install rack -v 1.0.1

mysql -uroot -pyourpasswd

create database redmine character set utf8;
create user 'redmine'@'localhost' identified by 'my_password';
grant all privileges on redmine.* to 'redmine'@'localhost';
exit;

NOTE: For MySQL prior 5.2.0 use this
create database redmine character set utf8;
create user 'redmine'@'localhost' identified by 'my_password';
grant all privileges on redmine.* to 'redmine'@'localhost' identified by 'my_password';
exit;

cd /srv/www/htdocs
wget http://rubyforge.org/frs/download.php/70488/redmine-0.9.4.zip
unzip redmine-0.9.4.zip
rm redmine-0.9.4.zip
mv redmine-0.9.4 redmine

cd /srv/www/htdocs/redmine
cp config/database.yml.example config/database.yml
vi config/database.yml

production:
  adapter: mysql
  database: redmine
  host: localhost
  username: redmine
  password: passwd
  encoding: utf8

cp config/email.yml.example config/email.yml
vi config/email.yml
NOTE: For more Help look here: http://redmineblog.com/articles/setup-redmine-to-send-email-using-gmail/

production:
  delivery_method: :smtp
  smtp_settings:
    tls: true
    address: "smtp.gmail.com" 
    port: '587'
    domain: "smtp.gmail.com" 
    authentication: :plain
    user_name: "your_email@gmail.com" 
    password: "your_password" 

aptitude install libapache2-mod-fastcgi libfcgi-ruby1.8
aptitude install libmysql-ruby libopenssl-ruby1.8

RAILS_ENV=production rake config/initializers/session_store.rb
rake generate_session_store
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data

aptitude install ruby-dev
gem install passenger
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/bin/passenger-install-apache2-module

NOTE: following file contents info comes from ".../passenger-install-apache2-module"

vi /etc/apache2/mods-available/passenger.load

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14/ext/apache2/mod_passenger.so

vi /etc/apache2/mods-available/passenger.conf

PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.14                                                 
PassengerRuby /usr/bin/ruby1.8

a2enmod passenger

vi /etc/apache2/sites-available/default

<VirtualHost *:80>                                                                                         
  ServerName www.yourhost.com                                                                             
  DocumentRoot /srv/www/htdocs/redmine/public    # <-- be sure to point to 'public'!                                   
  <Directory /srv/www/htdocs/redmine/public>                                                                           
    AllowOverride all                            # <-- relax Apache security settings                                  
    Options -MultiViews                          # <-- MultiViews must be turned off                                   
  </Directory>                                                                                            
</VirtualHost>

cd /srv/www/htdocs/redmine
chmod -R 775 ./*
chown -R root:root ./*
mkdir tmp public/plugin_assets
chown -R nobody:nogroup files log tmp public/plugin_assets
chmod -R 775 files log tmp public/plugin_assets

/etc/init.d/apache2 restart

Put Redmine in a Folder

mkdir /srv/www/apps
mv /srv/www/htdocs/redmine /srv/www/apps/redmine
ln -s /srv/www/apps/redmine /srv/www/htdocs/redmine
vi /etc/apache2/sites-available/default

<VirtualHost *:80>
  ServerName www.yourhost.com
  DocumentRoot /srv/www/htdocs
  <Directory /srv/www/htdocs>
    AllowOverride all
    Options -MultiViews
  </Directory>

  RailsBaseURI /redmine
  <Directory /srv/www/htdocs/redmine>
    Options -MultiViews
  </Directory>                                                                                     
</VirtualHost>

/etc/init.d/apache2 restart

Repositories

I used following Repos:
Replace lenny with etch if you are using Debian etch(stable)
You find more Repos here:
http://wiki.unixboard.de/index.php/Repositories_fuer_Debian_und_Derivate

vi /etc/apt/sources.list

deb http://ftp.de.debian.org/debian/ lenny main contrib non-free
deb-src http://ftp.de.debian.org/debian/ lenny main contrib non-free

deb http://security.debian.org/ lenny/updates main contrib non-free
deb-src http://security.debian.org/ lenny/updates main contrib non-free

deb http://security.debian.org/ lenny/updates main contrib non-free
deb-src http://security.debian.org/ lenny/updates main contrib non-free

deb http://volatile.debian.org/debian-volatile lenny/volatile main contrib non-free