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

« Previous - Version 12/19 (diff) - Next » - Current version
André Domarques, 2013-11-14 19:27


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: 2013-11-14 (see doc history)

Required packages

apt-get -y install sudo ssh bzip2 zip unzip apache2 libapache2-mod-passenger mysql-server libmysqlclient-dev ruby ruby1.9.1-dev git git-core gitolite libmagickcore-dev libmagickwand-dev

Users and ssh-key

Create an user for Redmine and another for Gitolite:

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 gitolite_admin_id_rsa.

sudo su - redmine
ssh-keygen -t rsa -N '' -f ~/.ssh/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/gitolite_admin_id_rsa.pub

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 that 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 ~
wget http://rubyforge.org/frs/download.php/77023/redmine-2.3.2.tar.gz
tar zxf redmine-2.3.2.tar.gz
mv redmine-2.3.2/* .
rm -Rf redmine-2.3.2

Create database and user

mysql -u root -p

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:

Create plugin assets directory

cd ~
mkdir public/plugin_assets

Now finish 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_git_hosting.git
git clone https://github.com/jbox-web/redmine_plugin_views_revisions.git

Install. It's necessary to run bundle again to install some new gems required by redmine_git_hosting plugin.

cd ~
bundle install
RAILS_ENV=production rake redmine:plugins:migrate
RAILS_ENV=production rake redmine:plugins:process_version_change
rake redmine_git_hosting:install_scripts RAILS_ENV=production WEB_USER=redmine

Apache mod_passenger configuration

Create a symbolic link.

su root
cd /var/www
ln -s /opt/redmine/public redmine

Configure the site.

vi /etc/apache2/sites-available/redmine

With following content:

RailsBaseURI /redmine
PassengerUserSwitching on
PassengerUser redmine
PassengerGroup redmine

Enable the site and restart apache.

a2ensite redmine
service apache2 restart

Hope this helps =D.