---

Trac 0.12.2 on openSuSE 12.1

This article describes the installation of a Trac Project Managment on openSuSE 12.1 Server.

My special thx goes to Chexx

What is Trac?

  • Trac is an enhanced wiki and issue tracking system for software development projects.
  • An integrated system for managing software projects.
  • An enhanced wiki.
  • A flexible web-based issue tracker.
  • An interface to the Subversion revision control system.

Have a look at their homepage:Trac Project Managment.

Any linux distribution comes with precompiled packages and we use them.

System Description:
* Standard openSuSE 12.1 Server, Runlevel 3.
* No graphical system is required.

We start:

Install these packages with "zypper"

zypper install python
zypper install python-setuptools
zypper install python-genshi
zypper install python-distribute
zypper install python-pygments
zypper install python-docutils (optional)
zypper install python-Babel
zypper install sqlite3
zypper install apache2
zypper install apache2-mod_wsgi

and now install Trac:

easy_install Trac
easy_install –U Trac

change to your path where the project should be installed

mkdir /data/trac-root
trac-admin /data/trac-root/myfirst initenv
trac-admin /data/trac-root/myfirst deploy /tmp/deploy

to use multiple Trac Projects we make a shared location, we must do this part only once!!

mkdir /data/trac-root/trac-shared
mkdir /data/trac-root/.egg-cache
mv /tmp/deploy/htdocs/common/* /data/trac-root/trac-shared/common
mv /tmp/deploy/cgi-bin/trac.wsgi /data/trac-root/trac-shared/cgi-bin/

and change trac.wsgi that it looks like:

sample "trac.wsgi" file:

#!/usr/bin/python
# may be needed if plugins "print" to stdout
#import sys
#sys.stdout = sys.stderr
import os
os.environ['PYTHON_EGG_CACHE'] = '/data/trac-root/trac-shared/.egg-cache'
import trac.web.main
application = trac.web.main.dispatch_request

now Apache2:

Add the "wsgi" module to Apache2 and restart:
edit "/etc/sysconfig/apache2" and add wsgi to the APACHE_MODULES=
so it looks like:
APACHE_MODULES="....wsgi"
save and restart Apache2

our first Trac config file, i call it "myfirst-trac.incl":

# http://trac.yourdomain.local/myfirst/
# replace all "myfirst" with "new" (routes to http://trac.youdromain.local/new)
# an include to /etc/apache2/vhosts.d/trac.conf
# let apache serve static content himself:
# (these must be before any script-aliases)
# - set alias for (trac-)global static content
Alias /myfirst/chrome/common /data/trac-root/trac-shared/common
# - set trac-site static content
Alias /myfirst/chrome/site /data/trac-root/myfirst/htdocs
<Directory /data/trac-root/myfirst/htdocs>
  # Options FollowSymLinks Indexes
  Order allow,deny
  Allow from all
</Directory>
# wsgi process group
WSGIDaemonProcess myfirst user=wwwrun group=www processes=1 threads=25 maximum-requests=20000
# serve all instances through single wsgi script
WSGIScriptAlias /myfirst /data/trac-root/trac-shared/cgi-bin/trac.wsgi
# setup location specifics
<Location /myfirst>
  SetEnv trac.env_path "/data/trac-root/myfirst"
  SetEnv trac.p_group "myfirst"
  SetEnv trac.locale "de_AT.UTF8"
  # configure auth here for whole trac
  # AuthType ...
  # Require valid-user
</Location>
# ev for authentication:
#<Location /myfirst/login>
# AuthType ...
# </Location>

and the "trac.conf" file, this is for all project the same:

# VirtualHost template
# Note: to use the template, rename it to /etc/apache2/vhost.d/yourvhost.conf.
# Files must have the .conf suffix to be loaded.
# See /usr/share/doc/packages/apache2/README.QUICKSTART for further hints
# about virtual hosts.
# NameVirtualHost statements can be added to /etc/apache2/listen.conf.
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
# ev. to try: <VirtualHost _default_:80>
# other readings: ServerAlias ??
<VirtualHost *:80>
ServerAdmin tom@yourdomain.com
ServerName trac.yourdomain.local
# don't loose time with IP address lookups
HostnameLookups Off
# needed for named virtual hosts
UseCanonicalName Off
# configures the footer on server-generated documents
ServerSignature On
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
    DocumentRoot /data/trac-root/htdocs
# virtual server requirement (virtual server root)
<Directory /data/trac-root/htdocs>
       Order allow,deny
       Allow from all
    </Directory>
# enable wsgi (cgi permission, global/common wsgi config)
<Directory /data/trac-root/trac-shared/cgi-bin>
       WSGIApplicationGroup %{GLOBAL}
       WSGIProcessGroup %{ENV:trac.p_group}
       Order allow,deny
       Allow from all
</Directory>
# let apache serve static content himself:
# (these must be before any script-aliases)
# - grant access (this file)
# - set alias(es) (in any included trac)
<Directory /data/trac-root/trac-shared/common>
       Options FollowSymLinks Indexes
       Order allow,deny
       Allow from all
</Directory>
# include differents trac(s)
Include /etc/apache2/vhosts.d/trac-myfirst.incl
Include /etc/apache2/vhosts.d/trac-mysecond.incl
</VirtualHost>
ev.

<<<------------>>> that`s it <<<------------>>>