Edgewall Software

Caveat: this page is not necessarily up to date…

As a general advice for any platform specific installation guide like this one, you should first make sure that the tips given here are not out of date with respect to the generic instructions given in TracInstall and TracUpgrade. The latter are documenting either the latest stable version of Trac, or the one about to be released (0.12 as of this writing). If you're planning to install an older version of Trac, have a look at the corresponding archived pages, for example 0.11/TracInstall and 0.11/TracUpgrade

Installing Trac on ArchLinux for Multiple Projects using Mod_Python

ArchLinux uses a lightweight package management system. It is released by a rolling binary system. Keep your Arch-Linux system up to date by command line pacman -Syu, which will retrieve the most recent versions of your packages.

In the following steps, set these variables:

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:

# 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 you 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 and svn_dav

Edit /etc/httpd/conf/httpd.conf, append following line:

LoadModule python_module           modules/mod_python.so
LoadModule dav_svn_module          modules/mod_dav_svn.so
LoadModule authz_svn_module        modules/mod_authz_svn.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 applying the following configuration:

  • 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's 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 the Trac database 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 your trac.ini file:

link = http://your_server_ip/trac
log_type = file    # we need check log to figure out problems
url = http://your_server_ip/trac/project1  # change to $PRJ


Create password file

htpasswd -c /home/trac/.htpasswd admin  # create 'admin' account
htpasswd /home/trac/.htpasswd new_user  # append a 'new_user' account

Create access file

Sample /home/svn/.svn.access:

* = r

admin = rw

Configure Apache as the web server

chown -R http.http $SROOT $TROOT  # allow httpd's owner 'http' 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 combined
    <Location />
        Order deny,allow
        Deny from all
        Allow from # <- allow local network only
    <Location /trac> #set up Trac handling
        Order deny,allow
        Deny from all
        Allow from # <- allow local network only
        AuthName "Trac Projects"
        AuthType Basic
        AuthUserFile /home/trac/.htpasswd # <- place to put password by htpasswd2
        Satisfy Any
        Require valid-user
        SetHandler mod_python
        PythonHandler trac.web.modpython_frontend
        PythonOption TracEnvParentDir /home/trac    # <-- change to $TROOT value
        PythonOption TracUriRoot /trac
    <Location /svn>
       DAV svn 
       SVNParentPath /home/svn/  # <- change to $SROOT
       AuthzSVNAccessFile /home/svn/.svn.access  # <- place to put access file
       AuthName "SVN Repo"
       AuthType Basic
       AuthUserFile /home/trac/.htpasswd # <- place to put password by htpasswd2
       Satisfy Any
       Require valid-user


Then restart your web server:

/etc/rc.d/httpd restart 
# if failed, manual start up httpd by following command, and check the information
apachectl -k start

Now, you should be able to access Trac at http://your_server_ip/trac/$PRJ.

Access via https (optional)

Data traffic via https will be safer, but it may be slower. To configure https, enter the following commands:

cd /etc/httpd/conf  # must change to this directory before doing the mod_ssl.txt
more mod_ssl.txt
  1. Follow the instructions in mod_ssl.txt to generate key files.
  2. Add the the lines of httpd-vhosts.conf to /etc/httpd/conf/extra/httpd-ssl.conf.
  3. Uncomment the include /etc/httpd/conf/extra/httpd-ssl.conf in /etc/httpd/conf/httpd.conf.
  4. Restart Apache by /etc/rc.d/httpd restart.
Last modified 4 years ago Last modified on Apr 21, 2018, 11:26:27 AM
Note: See TracWiki for help on using the wiki.