Project

General

Profile

Actions

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

About

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
exit

Configuring Gitolite

dpkg-reconfigure gitolite

Type data bellow:

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

Note about SSH

Click bellow to expand.

Note about SSH

Visudo configuration

visudo

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.

Download

sudo su - redmine
cd ~
wget http://www.redmine.org/releases/redmine-2.6.0.tar.gz
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:

Download

cd ~/plugins
git clone https://github.com/jbox-web/redmine_bootstrap_kit.git
git clone https://github.com/jbox-web/redmine_git_hosting.git
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/redmine_gitolite_admin_id_rsa.pub /opt/redmine/plugins/redmine_git_hosting/ssh_keys/redmine_gitolite_admin_id_rsa.pub

Configure GL_GITCONFIG_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
exit

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:

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

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

Redmine

Configure the Redmine default URL (important):

Administration > Settings > General
http://your_ip_or_fqdn/redmine/settings?tab=general

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

Set the available repositories

Administration > Settings > Repositories
http://your_ip_or_fqdn/redmine/settings?tab=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
http://your_ip_or_fqdn/redmine/settings/plugin/redmine_git_hosting?tab=gitolite_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
http://your_ip_or_fqdn/redmine/settings/plugin/redmine_git_hosting?tab=gitolite_config_access

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

Troubleshooting

Logs

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

Plugin

You also must check, regarding the plugin:

http://redmine-git-hosting.io/troubleshooting/

Environment details

Click bellow to expand.

Environment details

Hope this helps =D.

Updated by Nicolas Rodriguez over 9 years ago · 19 revisions