Edgewall Software

Version 3 (modified by dlin.tw@…, 13 years ago) ( diff )

Installing Trac on ArchLinux for Multiple Projects using Mod_Python

ArchLinux is powered by a simple and lightweight package management system. It is release by rolling binary system. Keep update by command line pacman -Syu will get the most recent version.

In following steps, I set these variable for simply input

TROOT=/home/trac  # put the multiple trac project's db
SROOT=/home/svn   # put the multiple project subversion repositories
PRJ=project1      # put each project's name

install packages

install depend packages from binary

pacman -S mod_python python-pysqlite subversion

Download trac from binary

Trac is already on community repository, check /etc/pacman.conf, make sure uncomment the following.

[community]
# Add your preferred servers here, they will be used first
Include = /etc/pacman.d/community

SUPFILES=(arch extra !unstable community !testing)

download and install it

pacman -S trac 

or, build trac from source

if want the newest version trac.

edit the /etc/abs/abs.conf, unmark the community

SUPFILES=(arch extra !unstable community !testing)
cd /var/abs/community/network/trac
vi PKGBUILD  # modify the version to the newest version
makepkg -g   # modify PKGBUILD with the correct md5 checksum
makepkg -c   # build binary package file, and clean up work files after build
sudo pacman -A *.pkg.tar.gz  # install it
sudo pacman -U *.pkg.tar.gz  # or, upgrade it, if already installed

configure mod_python

edit /etc/httpd/conf/httpd.conf, append following line

LoadModule python_module modules/mod_python.so

use following line to restart apache, check /var/log/httpd/error.log, if failed

/etc/rc.d/httpd restart

Tips: you can check it by http://your_server_ip/server-info after following config

edit /etc/httpd/conf/httpd.conf, uncomment following line
Include /etc/httpd/conf/extra/httpd-info.conf

edit /etc/httpd/conf/extra/httpd-info.conf, modify the "Allow from" to your client ip address

setup subversion for each project

mkdir -p $SROOT/$PRJ
mkdir /tmp/$PRJ
mkdir /tmp/$PRJ/branches
mkdir /tmp/$PRJ/tags
mkdir /tmp/$PRJ/trunk
svnadmin create $SROOT/$PRJ
svn import /tmp/$PRJ file://$SROOT/$PRJ -m "initial import"
rm -rf /tmp/$PRJ
svn ls -v file://$SROOT/$PRJ   # check it

setup trac db for each project

mkdir -p $TROOT

setup by interactive questions

trac-admin $TROOT/$PRJ initenv 

or, by command line parameters

trac-admin $TROOT/$PRJ initenv $PRJ sqlite:db/trac.db svn $SROOT/$PRJ /usr/share/trac/templates

edit $TROOT/$PRJ/conf/trac.ini

[header_logo]
link = http://your_server_ip/prjs
[logging]
log_type = file    <-- we need check log to figure out problems
[project]
url = http://your_server_ip/prjs/project1  <-- change to $PRJ

configure apache

chown -R nobody $SROOT $TROOT  # allow httpd's owner 'nobody' could read/write

edit /etc/httpd/conf/httpd.conf,  uncomment following line
Include /etc/httpd/conf/extra/httpd-vhosts.conf

edit /etc/httpd/conf/extra/httpd-vhosts.conf, append following lines
<VirtualHost *:80>
    ServerAdmin your_name@email.address
    DocumentRoot /home/trac/  # <- change to $TROOT
    ServerName your_server_ip
    ErrorLog /var/log/httpd/trac.error_log
    CustomLog /var/log/httpd/trac.access_log common
    <Location /prjs> #set up Trac handling
        SetHandler mod_python
        PythonHandler trac.web.modpython_frontend
        PythonOption TracEnvParentDir /home/trac     <-- change to $TROOT value
        PythonOption TracUriRoot /prjs
    </Location>
</VirtualHost>

to be continue…

Note: See TracWiki for help on using the wiki.