This is a tutorial for installing redmine on Ubuntu 8.04 with SVN and Git integration (managed by Gitosis and a redmine gitosis plugin).

UPDATE #1 - 2011-04-23: New Tutorial for Redmine with Git and Gitosis on Ubuntu 11.04:

1. Install redmine

Get recent trunk version from github (currently 1.02)

apt-get install git-core
mkdir /var/www
cd /var/www
git clone git://

Install packages

apt-get install ruby ruby1.8-dev libgemplugin-ruby libgemplugin-ruby1.8  mysql-server apache2-mpm-prefork wget libruby-extras libruby1.8-extras rails subversion rake apache2-prefork-dev libapache-dbi-perl libapache2-mod-perl2 libdigest-sha1-perl libapache2-svn libmysqlclient15-dev build-essential libcurl4-openssl-dev cron

Create database

mysql -u root -p
$> create database redmine character set utf8;
$> create user 'redmine'@'localhost' identified by 'my_password';
$> grant all privileges on redmine.* to 'redmine'@'localhost';

Configure Database Settings

cp redmine/config/database.yml.example redmine/config/database.yml
nano redmine/config/database.yml
	adapter: mysql
	database: redmine
 	host: localhost
 	username: redmine
	password: 47w8t2938qfge2
 	encoding: utf8

Install Rubygem (Ubuntu 8.04 has an older version)

tar xvfz rubygems-1.3.7.tgz
cd rubygems-1.3.7
ruby setup.rb
ln -s /usr/bin/gem1.8 /usr/bin/gem

Install Rails + Rack

gem install rails -v=2.3.5
gem install rack -v=1.0.1
gem install mysql

Configure redmine

cd /var/www/redmine
chown -R www-data:www-data files log tmp public/plugin_assets
chmod -R 755 files log tmp public/plugin_assets
rake generate_session_store
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data

Test redmine

ruby script/server webrick -e production

Now you can check if everything works

2. Apache Integration

Install passenger (Modify version numbers if needed)

gem install passenger
echo "LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.0/ext/apache2/" > /etc/apache2/mods-available/passenger.load
ln -s /etc/apache2/mods-available/passenger.load /etc/apache2/mods-enabled/passenger.load
nano /etc/apache2/mods-available/passenger.conf
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.0
PassengerRuby /usr/bin/ruby1.8

Configure Apache

nano /etc/apache2/sites-available/my_domain

DocumentRoot /var/www/redmine/public

LogLevel warn
ErrorLog /var/log/apache2/redmine_error
CustomLog /var/log/apache2/redmine_access combined

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
nano /etc/apache2/apache2.conf

Add this at the end of the file:

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

Activate your site

ln -s /etc/apache2/sites-available/my_domain /etc/apache2/sites-enabled/my_domain

Remove default entry

rm /etc/apache2/sites-enabled/000-default

Restart Apache and it should work

/etc/init.d/apache2 restart

3. Subversion integration

ln -s /var/www/redmine/extra/svn/ /usr/lib/perl5/Apache/
nano /etc/apache2/sites-available/svn
# /svn location for users
     PerlLoadModule Apache::Redmine
       DAV svn
       SVNParentPath "/var/repos/svn"
       Order deny,allow
       Deny from all
       Satisfy any
       PerlAccessHandler Apache::Authn::Redmine::access_handler
       PerlAuthenHandler Apache::Authn::Redmine::authen_handler
       AuthType Basic
       AuthName "Redmine SVN Repository" 
       #read-only access
          Require valid-user
          Allow from
          Allow from localhost
           Satisfy any
       # write access
         Require valid-user
       ## Mysql-Settings
       RedmineDSN "DBI:mysql:database=redmine;host=localhost"
       RedmineDbUser "redmine"
       RedmineDbPass "my_password"
          Order deny,allow
          Allow from localhost
          Allow from
          Deny from all
ln -s /etc/apache2/sites-available/svn /etc/apache2/sites-enabled/svn
mkdir -p /var/repos/svn
chown -R www-data:www-data /var/repos
chmod 0750 /var/repos/svn

Go to Administration - Settings - Repositories on your redmine site and enable “WS for repository management”. Then generate an API key.

Test the automatic generation:

ruby /var/www/redmine/extra/svn/reposman.rb --redmine --svn-dir /var/repos/svn --owner www-data --url --verbose --key=my_api_key

If everything works create an crontab for this:

nano /etc/cron.d/redmine
10 * * * * root ruby /var/www/redmine/extra/svn/reposman.rb --redmine --svn-dir /var/repos/svn --owner www-data --url --verbose --key=my_api_key

Now you are ready to use SVN with redmine

4. Git integration

Install needed packages:

gem install inifile
apt-get install libnet-ssh-ruby1.8 python-setuptools
gem install lockfile
easy_install pip
pip install virtualenv

Add an user for gitosis:

adduser --system --shell /bin/bash --gecos 'Git Administrator' --group --disabled-password --home /opt/gitosis git

Create an ssh-key (with empty passphrase):

sudo -H -u git ssh-keygen -t dsa

Create an Virtual Environment for python and install gitosis:

sudo -u git virtualenv ~git/virtualenv
sudo -u git ~git/virtualenv/bin/pip install git+git://
echo "source $HOME/virtualenv/bin/activate" | sudo -u git tee -a ~git/.bashrc > /dev/null
sudo -u git cat ~git/.ssh/ | sudo -H -u git ~git/virtualenv/bin/gitosis-init

Install redmine-gitosis plugin:

cd /var/www/redmine/
chown -R www-data:www-data /var/www/redmine
script/plugin install git://

Patch the plugin:

nano /var/www/redmine/vendor/plugins/redmine-gitosis/lib/gitosis.rb
require 'lockfile'
    require 'inifile'
    require 'net/ssh'
    module Gitosis
      # server config
      GITOSIS_URI = ''
      GITOSIS_BASE_PATH = '/opt/gitosis/repositories/'
      # commands
      ENV['GIT_SSH'] = SSH_WITH_IDENTITY_FILE = File.join(RAILS_ROOT, 'vendor/plugins/redmine-gitosis/extra/')

Configure SSH:

mkdir /var/www/.ssh
chown -R www-data:www-data /var/www/.ssh
sudo -u www-data ssh

Migrate plugin:

rake db:migrate_plugins RAILS_ENV=production

Remove standard ssh-key and change it to the created one:

rm /var/www/redmine/vendor/plugins/redmine-gitosis/extra/ssh/private_key
cp ~git/.ssh/id_dsa /var/www/redmine/vendor/plugins/redmine-gitosis/extra/ssh/private_key
chown -R www-data:www-data /var/www/redmine

Test if the www-data user can read the key:

sudo -u www-data cat /var/www/redmine/vendor/plugins/redmine-gitosis/extra/ssh/private_key

Add the www-data user to the git group:

usermod -a -G git www-data

Have fun!