How to install Trac, Agilo for Scrum and Git browser on Ubuntu 11.04

Agilo for Scrum is a project management tool for Scrum. Agilo is open source software, but you can also buy Pro extension. It is a web application, based on Trac, which is a great lightweight, flexible and extensible ticketing software.

I need Agilo for Scrum with support for Git and user accounts and I will host it on Apache web server with mod_WSGI. MySQL is my choice for database. There are a lot of other possibilities for Agilo/Trac installation, but this post should be a good reference even in that case. 

Get all software we need

First we have to get all software that is going to be used. We will need apache web server, WSGI module, mysql server and python setuptools.

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install apache2 libapache2-mod-wsgi python-setuptools python-genshi mysql-server python-mysqldb subversion git-core
sudo apt-get install python-pybabel python-docutils python-pygments python-tz

Now we have to install Trac, AccountManager and GitPlugin. We will do that with setuptools.

sudo easy_install Trac==0.12
sudo easy_install https://trac-hacks.org/svn/accountmanagerplugin/trunk
sudo easy_install http://github.com/hvr/trac-git-plugin/tarball/master

We will download Agilo from their webiste. There are eggs availible for Python 2.4, 2.5 and 2.6 (direct download links for Agilo 1.3.3: 2.4, 2.5, 2.6). Downloaded file must be unziped and installed using setuptools.

unzip binary_agilo-//version nr//_PRO-py//your python version//.egg.zip
sudo easy_install binary_agilo-//version nr//_PRO-py//your python version//.egg

Configure MySQL

We are going to need one database and user with all privileges for that database. First login:

mysql -u root -p
//type in root password//

Now create database and user:

CREATE DATABASE trac DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
GRANT ALL ON trac.* TO trac@localhost IDENTIFIED BY 'yourpassword';

MySQL connection string for this case would be:

mysql://trac:yourpassword@localhost/trac

Create and deploy Trac project

We'll need one Trac project for our installation. We can create one using trac-admin tool. We'll be asked for some basic configuration. When installer asks us about database configuration we have to enter MySQL string from previous chapter.

sudo trac-admin /path/to/trac/project initenv

Now we have to deploy our project (create .wsgi file). We will use trac-admin once again.

sudo trac-admin /path/to/trac/project deploy /path/to/trac/project

Correct permissions for Apache.

sudo chown -R www-data:www-data /path/to/trac/project

Configure Apache for WSGI

We create new config file in Apache's conf.d folder.

sudo nano /etc/apache2/conf.d/trac.conf

Config file should look something like this.

 WSGIScriptAlias /trac /path/to/trac/project/deploy/cgi-bin/trac.wsgi
    <directory  /path/to/trac/project/deploy/cgi-bin>
     WSGIApplicationGroup %{GLOBAL}
     Order deny,allow
     Allow from all
    </directory>

Enable Apache's WSGI module.

sudo a2enmod wsgi

And finnaly restart Apache.

sudo /etc/init.d/apache2 restart

Basic Trac installation should be now already availible at http://ip-or-domain/trac.

Install Agilo for Scrum

We have to enable Agilo, when Trac works. We can do that in Trac's config file. Let's open it.

sudo nano /path/to/trac/project/conf/trac.ini

Search for "Component" part and add following lines.

[components] 
agilo.* = enabled
# the following lines are only required to use Agilo Pro 
agilo_common.* = enabled
agilo_pro.* = enabled

Upgrade Trac's database.

sudo trac-admin /path/to/trac/project upgrade

Agilo for Scrum should be enabled now. Visit your Trac installation in web browser to check out.

Enable Git repository browsing

We use Git at work. Trac also supports other most popular versioning systems if you need something else. Git extension was already installed in first part of this HowTo. Now we just have to enable it. We will open trac.ini once again and add following lines in "trac" and "git" sections.

[components]
tracext.git.* = enabled

[trac]
# simple single-repository configuration
repository_dir = /path/to/git/repo
repository_type = git

## the following settings are only supported for plugin version 0.11 or later
[git]
## let Trac cache meta-data via CachedRepository wrapper; default: false
cached_repository = true

## disable automatic garbage collection for in-memory commit-tree cache; default: false
persistent_cache = true

## length revision sha-sums should be tried to be abbreviated to (must be >= 4 and <= 40); default: 7
shortrev_len = 6

## (0.12.0.3+) minimum length for which hex-strings will be interpreted as commit ids in wiki context; default: 40
wiki_shortrev_len = 7

## executable file name (in case of doubt use absolute path!) of git binary; default: 'git'
git_bin = /usr/bin/git

## (0.12.0.5+) define charset encoding of paths stored within git repository; default: 'utf-8'
git_fs_encoding = latin1

## (0.12.0.3+) enable reverse mapping of git email addresses to trac user ids; default: false
trac_user_rlookup = true

## (0.12.0.3+) use git-committer id instead of git-author id as changeset owner; default: true
use_committer_id = false

## (0.12.0.3+) use git-committer timestamp instead of git-author timestamp as changeset time; default: true
use_committer_time = false

Change this values upon your needs. Put special attention to git_bin and repository_dir. Link to Git browser should appear in Agilo's main menu if everything went fine.

Enable AccountManager

AccountManager was already installed, so we just have to enable it. Open config file once again and add following lines to "components" section. AccountManager supports various password storing backends. We'll use htpasswd here.

[components]
trac.web.auth.LoginModule = disabled
acct_mgr.web_ui.LoginModule = enabled
acct_mgr.web_ui.RegistrationModule = disabled
trac.web.auth.loginmodule = disabled
acct_mgr.htfile.HtPasswdStore = enabled

[account-manager]
account_changes_notify_addresses =
password_store = HtPasswdStore
htpasswd_hash_type =
password_file = /path/to/htpasswd/file

If we want to login to Agilo, we have to create at least one username in htpasswd file. We can do tis with htpasswd command.

htpasswd -c /path/to/htpasswd/file admin

We can configure permissions with trac-admin.

trac-admin /path/to/projenv permission add admin TRAC_ADMIN

TRAC_ADMIN is superuser permission. More info about permissions in Trac can be found in Trac's wiki.

Tags: 

Member of The Internet Defense League