Edgewall Software

Installing and Running Trac on Debian Sarge

Running from Trunk

There is a page on running from trunk on TracOnDebianFromTrunk

Non-Default packages

Sarge users who want to track Edgewall's latest version need to add a few lines to their /etc/apt/sources.list :

# Trac and clearsilver
deb http://ftp.edgewall.com/pub/debian sarge trac

Then update APT's cache :

 $ apt-get update

Whether the above steps to get Edgewall's version instead of Debian's were followed or not, installing Trac should be as simple as installing the trac package.

Setting up Subversion and Trac

From a basic installation of Sarge, you'll need to install apache2, subversion, trac, and libapache2-svn. If you have previously installed some portion of these, adapt as needed.

Prerequisites

  $ apt-get install apache2
  $ apt-get install subversion
  $ apt-get install libapache2-svn
  $ apt-get install python-subversion
  $ apt-get install trac

Getting Subversion working

To create a Subversion project at /var/svn/project, issue these commands to get SVN up and running:

Note: As of this writing, the default Subversion package uses the BDB filesystem; if this is acceptable, feel free to omit the extra argument to svnadmin create.

  $ mkdir /var/svn
  $ mkdir /var/svn/project
  $ mkdir /tmp/project
  $ mkdir /tmp/project/branches
  $ mkdir /tmp/project/tags
  $ mkdir /tmp/project/trunk
  $ svnadmin create /var/svn/project --fs-type fsfs
  $ svn import /tmp/project file:///var/svn/project -m "initial import"
  $ rm -rf /tmp/project

Add the following to /etc/apache2/mods-available/dav_svn.conf:

#SVN dir
<Location /svn>
  DAV svn
  SVNParentPath /var/svn
  SVNAutoversioning on
  AuthType Basic
  AuthName "SVN - Your Project"
  AuthUserFile /etc/apache2/svn.passwd
  Require valid-user
</Location>

Fix permissions to the repository:

  $ find /var/svn/project -type f -exec chmod 660 {} \;
  $ find /var/svn/project -type d -exec chmod 2770 {} \;
  $ chown -R root.www-data /var/svn/project

Enable installed apache modules:

  $ a2enmod dav
  $ a2enmod dav_fs

Add Subversion users. Note the different syntax for creating the first user from creating each additional user.

cd /etc/apache2
htpasswd2 -c svn.passwd user1 (you'll be prompted for the password)
htpasswd2 svn.passwd user2 (you'll be prompted for the password)

Restart Apache2.

  $ apache2 -k restart

Go to http://servername.foo.com/svn/project to see the empty directories as imported. Do not move on to the next step until this works correctly!

Getting Trac running:

These instructions will install a trac environment at /var/trac/project, without using the mod_python extentions. Initialize the Trac environment with the following commands:

  $ mkdir /var/trac
  $ trac-admin /var/trac/project initenv 
  $ find /var/trac/project -type f -exec chmod 660 {} \;
  $ find /var/trac/project -type d -exec chmod 2770 {} \;
  $ chown -R root.www-data /var/trac/project

The trac-admin command above will prompt you to enter the project name, the path to the trac environment, and the path to the Trac templates directory; then it printed out a bunch of stuff.

Next, edit /etc/apache2/sites-available/default. Comment out the existing ScriptAlias and <Directory "/usr/lib/cgi-bin"> directives. To install trac at a URL like http://servername.foo.com/proj , add this at the end:

Alias /trac "/usr/share/trac/htdocs"
ScriptAlias /proj /usr/share/trac/cgi-bin/trac.cgi
<Location "/proj">
 SetEnv TRAC_ENV "/var/trac/project"
</Location>
  
<Directory "/usr/share/trac/htdocs">
  Options Indexes MultiViews
  AllowOverride None
  Order allow,deny
  Allow from all
</Directory>
  
# You need something like this to authenticate users
<Location "/proj/login">
  AuthType Basic
  AuthName "project"
  AuthUserFile /var/www/trac.htpasswd
  Require valid-user
</Location>

Providing /etc/apache2/svn.passwd in the space above will allow you to use the same usernames and passwords in both Subversion and Trac.

If you choose to authenticate seperately, add Trac users, and restart Apache:

  $ cd /var/www
  $ htpasswd2 -c trac.htpasswd user1     (you'll be prompted for the password)
  $ htpasswd2 trac.htpasswd bar user2    (you'll be prompted for the password)  
  $ apache2 -k restart

Finally, test by going to http://servername.foo.com/proj/

Note also that there is a trac 0.10.3 package for sarge at backports.org (http://www.backports.org/debian sarge-backports main) that just installed nicely for me.

Last modified 15 years ago Last modified on May 1, 2009, 2:41:56 PM
Note: See TracWiki for help on using the wiki.