GitHub clone based on Debian Squeeze Gitolite Git Git-Daemon MySQL Nginx and Mongrel Cluster » History » Version 2

« Previous - Version 2/6 (diff) - Next » - Current version
Paul zur Horst-Meyer, 2012-03-31 23:44

GitHub clone based on Debian Squeeze, Gitolite, Git, Git-Daemon, MySQL, Nginx and Mongrel Cluster


  • fresh und updated debian squeeze installation (preferable 64bit)
  • login as root

PS: i am sorry, but i don´t like to comment any part and command ob this install notes.
Copy and past should be work :P

Debian package install:

apt-get install imagemagick ruby ruby-dev libruby rubygems mysql-server libmysqlclient-dev libmagickwand-dev git sudo nginx

Ruby Gems package install:

gem install lockfile inifile net-ssh mysql rmagick rdoc mongrel mongrel_cluster
gem install rails -v=2.3.14
gem install i18n -v=0.4.2

you have to link some installed gems:

ln -s /var/lib/gems/1.8/bin/rake /usr/bin/
ln -s /var/lib/gems/1.8/bin/mongrel_rails /usr/bin/

User configuration

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

run visudo and add this content:

redmine  ALL=(git)      NOPASSWD:ALL
git ALL=(redmine) NOPASSWD:ALL

Setup Gitolite

... as Git user:

su git
cd ~

generate gitolite key pair for administration:

ssh-keygen -t dsa
  • Install path: /opt/gitolite/.ssh/gitolite_admin_id_rsa
  • using passphrase: no

getting sources:

wget -O gitolite.tar.gz
tar -xf gitolite.tar.gz

create .profile file in git home directory and put content:


prepare setup and install gitolite

source .profile
gl-setup -q ~/.ssh/
rm -rf sitaramc-gitolite-d59bc35 gitolite.tar.gz

give Redmine the administration key pair

mkdir 0700 /opt/redmine/.ssh
cp /opt/gitolite/.ssh/gitolite_admin_id_rsa* /opt/redmine/.ssh
chown -R redmine:redmine /opt/redmine/.ssh

Setup Redmine

... as Redmine user

su redmine
cd ~

getting sources:

wget -O redmine.tar.gz
tar -xf redmine.tar.gz
mv redmine-redmine-3490d2a/* .
rm -rf redmine-redmine-3490d2a redmine.tar.gz

prepare database configuration for Redmine:

add a MySQL user and a database for Redmine (find your own way :P):

cp config/database.yml.example config/database.yml
nano config/database.yml

setup tables and example data:

rake generate_session_store
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data

Setup plugin to manage repositories

cd vendor/plugins

getting sources:

wget -O redmine_plugin.tar.gz
tar -xf redmine_plugin.tar.gz
mv ericpaulbishop-redmine_git_hosting-fdca404 redmine_git_hosting
rm redmine_plugin.tar.gz

edit redmine_git_hosting/init.rb file and customize like you prefare, e.g:

httpServer 'yourRedmine.tld'
gitServer 'yourRedmine.tld'

comment out line 87 to disable Git Urls in repository view if you like

connect to localhost and accept the public key, cancel with ctrl+c and migrate the plugin

cd ~
ssh localhost
RAILS_ENV=production rake db:migrate_plugins

install mongrel/rails patch

cd ~/config/initializers/

Prepare Mongrel


mkdir /etc/mongrel
mkdir /var/run/mongrel
chown redmine:redmine /var/run/mongrel
mkdir /var/log/mongrel
chown redmine:redmine /var/log/mongrel


mongrel_rails cluster::configure -e production -p 3000 -N 3 -c /opt/redmine -C /etc/mongrel/redmine-cluster.yml -a --user redmine --group redmine -l /var/log/mongrel/mongrel.log -P /var/run/mongrel/

auto start up:

download "Redmine start script" 
chmod +x /etc/init.d/redmine
update-rc.d redmine defaults

Setup Nginx

creating own SSL Cert. chain (only for testing, example!):

mkdir /etc/nginx/ssl
cd /etc/nginx/ssl
openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
cp server.key
openssl rsa -in -out server.key
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

download Nginx configuration and copy to /etc/nginx/sites-available/default, just overwrite existing file.

Setup Git-Daemon

download "Git-Daemon start script" to /etc/init.d/git-daemon

chmod +x /etc/init.d/git-daemon
update-rc.d -f git-daemon defaults



Login at http://yourRedmine.tld with:

Login: admin
password: admin Magnifier - Redmine start script (782 Bytes) Paul zur Horst-Meyer, 2012-03-31 23:41

default.txt Magnifier - Nginx configuration (456 Bytes) Paul zur Horst-Meyer, 2012-03-31 23:41

git_daemon.txt Magnifier - Git-Daemon start script (1.53 KB) Paul zur Horst-Meyer, 2012-03-31 23:41