Project

General

Profile

Actions

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

Revision 1/19 | Next »
André Domarques, 2013-09-12 05:47


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

HowTo Install Redmine 2.x (MySQL) integrated with Gitolite 2.x 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, please let me know

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

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

Configuring Gitolite

dpkg-reconfigure gitolite

Type data bellow:

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

{{colapse(Note about SSH)
If you try to connect gitolite (user: git) using redmine user via ssh, will be prompted password... OMG! but both users wasn't created without password? See what happens:

redmine@redmine:~$ ssh -v git@localhost

...
The authenticity of host 'localhost (::1)' can't be established.
ECDSA key fingerprint is d5:da:b9:10:c4:9b:51:75:65:f3:64:81:b5:6c:1a:1a.
Are you sure you want to continue connecting (yes/no)? yes
...
...
debug1: Trying private key: /opt/redmine/.ssh/id_rsa
debug1: Trying private key: /opt/redmine/.ssh/id_dsa
debug1: Trying private key: /opt/redmine/.ssh/id_ecdsa
debug1: Next authentication method: password
git@localhost's password:

You can solve this by simply creating a symbolic link:

ln -s /opt/redmine/.ssh/redmine_gitolite_admin_id_rsa /opt/redmine/.ssh/id_rsa

Or even using ssh -i identity_file (check http://unixhelp.ed.ac.uk/CGI/man-cgi?ssh+1 for more details)
}}

Visudo confguration

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:
http://www.redmine.org/plugins/redmine-gitolite
http://jbox-web.github.io/redmine_git_hosting/
https://github.com/jbox-web/redmine_git_hosting

Download.

cd ~/plugins
git clone https://github.com/jbox-web/redmine_git_hosting.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
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

RailsBaseURI /redmine
PassengerUserSwitching on
PassengerUser redmine
PassengerGroup redmine

Enable the site and restart apache.

a2ensite redmine
service apache2 restart

{{colapse(h2. Environment details)

Debian Wheezy (netinst - only with basic packages plus ssh server)

cat /etc/debian_version

7.1

uname -a

Linux redmine 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1+deb7u1 x86_64 GNU/Linux)

cat /etc/hostname

redmine

dpkg -l

ii  apache2                            2.2.22-13
ii  git                                1:1.7.10.4-1+wheezy1
ii  gitolite                           2.3-1
ii  libapache2-mod-passenger           3.0.13debian-1
ii  libmagickcore-dev                  8:6.7.7.10-5+deb7u2
ii  libmagickwand-dev                  8:6.7.7.10-5+deb7u2
ii  mysql-server                       5.5.31+dfsg-0+wheezy1
ii  ruby1.9.1-dev                      1.9.3.194-8.1+deb7u1

gem env

RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.23
  - RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-linux]
  - INSTALLATION DIRECTORY: /var/lib/gems/1.9.1
  - RUBY EXECUTABLE: /usr/bin/ruby1.9.1
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /var/lib/gems/1.9.1
     - /opt/redmine/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

}}

Hope this help =D.

Updated by André Domarques over 10 years ago · 1 revisions