HowTo Install Redmine 2 integrated with Gitolite 2 on Debian Wheezy with Apache and Phusion Passenger » History » Revision 17

« Previous | Revision 17/19 (diff) | Next »
André Domarques, 2015-01-08 19:59
Updated to Redmine 2.6.0 and redmine_git_hosting 0.7.9

HowTo Install Redmine 2 integrated with Gitolite 2 on Debian Wheezy with Apache and Phusion Passenger


A quick step-by-step for install Redmine and Gitolite plugin on Debian Wheezy mainly using default packages.

If I missed something, let me know

Last update

Date: 2015-01-08
Sumary: Updated to Redmine *2.6.0* and redmine_git_hosting *0.7.9*.
See doc history for more info and/or instructions for redmine_git_hosting 0.6.x (deprecated).

Required packages

aptitude update && aptitude -y install sudo ssh bzip2 zip unzip apache2 libapache2-mod-passenger mysql-server libmysqlclient-dev ruby ruby-dev git git-core gitolite imagemagick libmagickcore-dev libmagickwand-dev libicu-dev

Users and ssh-key

Create an user for Redmine (redmine) and another for Gitolite (git):

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

Generate a ssh-key for redmine user. This user will be used as admin of Gitolite. The name of key should be redmine_gitolite_admin_id_rsa.

su redmine
ssh-keygen -t rsa -N '' -f ~/.ssh/redmine_gitolite_admin_id_rsa

Configuring Gitolite

dpkg-reconfigure gitolite

Type data bellow:

  • user: git
  • repos path: /opt/gitolite
  • admin ssh-key: /opt/redmine/.ssh/

Note about SSH

Click bellow to expand.

Note about SSH

Visudo configuration


Add the following lines:

# temp - *REMOVE* after installation
redmine    ALL=(ALL)      NOPASSWD:ALL

# redmine gitolite integration
redmine    ALL=(git)      NOPASSWD:ALL
git        ALL=(redmine)  NOPASSWD:ALL

Note that redmine user will be able to run root commands, but this is just to simplify the next steps. REMOVE this line after installation.

Redmine installation

The installation and configuration is like the official documentation. Simply reproducing to maintain the flow on this how-to.


sudo su - redmine
cd ~
tar zxf redmine-2.6.0.tar.gz
mv redmine-2.6.0/* .
rm -Rf redmine-2.6.0

Create database and user

mysql -u root -p -v -e "CREATE DATABASE redmine CHARACTER SET utf8;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'redmine';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';"

Configure database and email

cd /opt/redmine/config
cp database.yml.example database.yml
cp configuration.yml.example configuration.yml
Check more at:

Finishing the installation

Create plugin assets directory

cd ~
mkdir public/plugin_assets

Now, complete the installation.

sudo gem install bundler
bundle install --without development test postgresql sqlite
rake generate_secret_token
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data

Redmine Gitolite integration

The plugin used on this how-to is the fork of JBox Web, you can get more information at:


cd ~/plugins
git clone
git clone
cd redmine_git_hosting
git checkout v0.7.9

Create symlinks

The current version of the plugin (0.7.9) now uses the directory /opt/redmine/plugins/redmine_git_hosting/ssh_keys/ to keep the ssh keys. So let's just create some symbolic links:

ln -s /opt/redmine/.ssh/redmine_gitolite_admin_id_rsa /opt/redmine/plugins/redmine_git_hosting/ssh_keys/redmine_gitolite_admin_id_rsa
ln -s /opt/redmine/.ssh/ /opt/redmine/plugins/redmine_git_hosting/ssh_keys/


This version now use some hooks that, by default on gitolite v2, will be blocked by the var GL_GITCONFIG_KEYS. On gitolite v3, this var is named GIT_CONFIG_KEYS.

sudo su - git
sed -i 's/$GL_GITCONFIG_KEYS = ""/$GL_GITCONFIG_KEYS = ".*"/g' /opt/gitolite/.gitolite.rc

Configure Automatic Repository Initialization (optional)

To configure the new feature "Automatic Repository Initialization" (optional), is necessary to customize the gitolite.conf file.

cd ~
git clone git@localhost:gitolite-admin.git
cd gitolite-admin/
echo "repo    @all
        RW+    = admin" >> conf/gitolite.conf
git commit -m 'Automatic Repository Initialization' conf/gitolite.conf
git push
cd ~
rm -rf gitolite-admin

Remember that this repository will be managed by redmine and their plugin.

Plugin installation

It's necessary to run bundle again to install some new gems required by the plugins.

cd ~
bundle install --without development
RAILS_ENV=production rake redmine:plugins:migrate

Apache mod_passenger configuration

Create a symbolic link, configure and enable the site and restart apache.

su root
cd /var/www
ln -s /opt/redmine/public redmine
echo "RailsBaseURI /redmine
PassengerUserSwitching on
PassengerUser redmine
PassengerGroup redmine" > /etc/apache2/sites-available/redmine
a2ensite redmine
service apache2 reload

Post-install configuration tasks

Remember to remove the sudo temp configuration:

# temp - *REMOVE* after installation
redmine    ALL=(ALL)      NOPASSWD:ALL

You'll need to do some configuration on Redmine and git_hosting plugin.


Configure the Redmine default URL (important):

Administration > Settings > General

This is set, by default, to localhost:3000, change it to your IP or FQDN.

Set the available repositories

Administration > Settings > Repositories

Uncheck what you don't have installed on your system. Just to avoid unnecessary log messages.

Redmine Git Hosting Plugin

First of all, check the configuration

Administration > Redmine Git Hosting Plugin > Config Test

Ensure if all settings are correct (users, paths, versions etc.).

Set your IP or FQDN to SSH, HTTP and/or HTTPS

Administration > Redmine Git Hosting Plugin > Acess

Those settings will be also used on git operations (clone, pull, push etc.).



If you have some trouble during the installation, you can check the following files:

  • /opt/gitolite/.gitolite/logs/gitolite-`date +%Y\-%m`.log
  • /opt/redmine/log/git_hosting.log
  • /var/log/apache2/error.log

If you use multitail:

multitail /opt/gitolite/.gitolite/logs/gitolite-`date +%Y\-%m`.log /opt/redmine/log/git_hosting.log /var/log/apache2/error.log


You also must check, regarding the plugin:

Environment details

Click bellow to expand.

Environment details

Hope this helps =D.

Updated by André Domarques over 9 years ago · 17 revisions