Cet article détaille l’installation "normale" de Trac puis l’installation sur Debian Sarge à partir d’une archive stable, avec le plugin pour Mercurial.

Installation de Trac
Trac is a minimalistic approach to web-based management of software projects. Its goal is to simplify effective tracking and handling of software issues, enhancements and overall progress.
L’installation se fait simplement par :
$ apt-get install trac
trac-admin
Trac vient avec l’outil trac-admin qui permet de créer un trac pour un projet existant :
$ trac-admin /path/to/trac initenv
Répondez aux questions posées (nom du projet, DB, repository type, path to repo, ...).
Vous pouvez voir la version de trac installée :
$ trac-admin --version
Trac et Mercurial
$ apt-get install trac-mercurial
Pour configurer votre Trac avec votre repo Mercurial, il vous faudra faire quelques adaptations dans le fichier "/path/to/trac/conf/trac/ini" :
si vous êtes en trac 0.10 rajoutez :
[components]
tracvc.hg.* = enabled
si vous êtes en trac 0.11 rajoutez :
[components]
tracext.hg.* = enabled
Sans cette étage, tous les repositories que vous créerez avec "hg" lanceront cette erreur : TracError : Unsupported version control system "hg". Check that the Python bindings for "hg" are correctly installed.
tracd
Tracd est un binaire qui lance un serveur trac simplement en spécifiant le port et le chemin du trac :
$ tracd --port 8000 /path/to/trac
Allez ensuite sur "http://localhost:8000/" et vérifier que ça marche.
Trac et Apache2 sur Sarge
installer trac
On peut installer trac par apt-get mais ce sera alors une vieille version (0.9). Je vous conseille d’aller sur http://svn.edgewall.com/repos/trac/tags/ et de prendre la dernière version stable :
$ svn co http://svn.edgewall.com/repos/trac/tags/trac-0.10.4/
$ cd trac-0.10.4/
$ python ./setup.py install
installation du plugin mercurial
Vous trouverez des informations sur la page wiki sur le plugin TracMercurial. Sur Sarge, le package "trac-mercurial" n’est pas disponible.
$ svn co http://svn.edgewall.com/repos/trac/sandbox/mercurial-plugin
on va créer un "egg" :
$ python setup.py bdist_egg
(...)
error: invalid command 'bdist_egg' (no module named 'distutils.command.bdist_egg')
Une erreur survient, on va se référer à la page wiki pour l’installation des plugins. On va tester notre "setuptools" :
$ python -c "import pkg_resources"
Traceback (most recent call last):
File "<string>", line 1, in ?
ImportError: No module named pkg_resources
setuptools n’est pas ou mal installé. Dans mon cas, il est déjà installé :
$ dpkg -l python2.3-setuptools
Souhait=inconnU/Installé/suppRimé/Purgé/H=à garder
| État=Non/Installé/fichier-Config/dépaqUeté/échec-conFig/H=semi-installé
||/ Nom
+++-===============
ii python2.3-setuptools
on va alors l’enlever
$ apt-get remove python2.3-setuptools
et le réinstaller à la sauce python (le lien vient du wiki de trac) :
$ wget http://peak.telecommunity.com/dist/ez_setup.py
$ python setup.py bdist_egg
on reteste :
$ python -c "import pkg_resources"
Normalement, ça ne donne aucune sortie, donc c’est bon. un "egg" a été créé qui contient notre plugin. Il ne reste plus qu’à le mettre dans notre trac :
$ cp /tmp/mercurial-plugin/dist/TracMercurial-0.10.0.2-py2.3.egg /path/to/trac/plugins/
on teste en démarrant notre démon :
$ tracd --port 8000 /path/to/trac/
ca marche :)
configurer apache
N’ayant pas besoin de performances accrues, je me suis contenté de rendre trac accessible par le biais d’un simple CGI :
donner les droits à apache
$ chown -R www-data:www-data /path/to/trac/
$ chmod -R ug+rw /path/to/trac/
configurer apache
ScriptAlias /trac /usr/share/trac/cgi-bin/trac.cgi
<Location /trac>
SetEnv TRAC_ENV "/path/to/trac"
</Location>
Voila pour une configuration sans restriction d’accès. Il vous faudra sûrement aller plus loin pour en mettre, mais ça c’est de la conf apache.
$ /etc/init.d/apache2 reload
hop !