Howto : installing TRAC on Debian Etch

CONVENTIONS :
————-

My projects are stored under /home/dev/project-name
The SVN repositories are stored under /home/svn/project-name
I often work on projects from the CLI and vi with user1
The web-server user/group is www-data

INSTALLING PACKAGES :
———————

If you don’t already have Apache and Subversion installed :

# apt-get install apache2
# apt-get install subversion

If you do :

# apt-get install trac
# apt-get install libapache2-svn

SETTING UP SVN :
—————-

If you don’t already have your SVN project set up :

# mkdir /home/dev/
# mkdir /home/svn/
$ svnadmin create /home/svn/project1
$ svn import /tmp/yourproject file:///home/svn/project1 -m “Initial import”
$ rm -fr /tmp/yourproject
$ svn checkout file:///home/svn/project1 /home/dev/project1

If you do :

Edit /etc/apache2/sites-available/default and add to the very end of the file :

    # SVN
    <Location /svn>
      DAV svn
      SVNParentPath /home/svn
      SVNAutoversioning on
      AuthType Basic
      AuthName “SVN”
      AuthUserFile /etc/apache2/passwd-svn
      Require valid-user
    </Location>

Set permissions to the repo :

# find /home/svn/project1 -type d | xargs chmod 2770
# find /home/svn/project1 -type f | xargs chmod -R 660
# chown user1:www-data /home/svn -R

SETTING UP APACHE :
——————-

Enable the required apache modules :

# a2enmod dav
# a2enmod dav_fs

Create the apache authentication file :

htpasswd -c /etc/apache2/passwd-svn user1

Restart Apache :
# /etc/init.d/apache2 force-reload

You should be able to see your project at http://home.domain.tld/svn/project1

SETTING UP TRAC :
—————–

# mkdir /home/trac
# trac-admin /home/trac/project1 initenv

You will be asked a few questions (project name, path to SVN repo, etc.)

# cd /home/trac
# chown -R user1:www-data /home/trac/project1/
# find -type d | xargs chmod 2775
# find -type f | xargs chmod 664

If you want to reach TRAC at a URL like http://home.domain.tld/project1&#8230;

Edit /etc/apache2/sites-available/default

Add to the end of the file :

    # TRAC PROJECT1
    ScriptAlias /project1 /usr/share/trac/cgi-bin/trac.cgi
    <Location “/project1”>
     SetEnv TRAC_ENV “/home/trac/project1”
    </Location>
     
    # PROJECT1 AUTH
    <Location “/project1/login”>
      AuthType Basic
      AuthName “project1”
      AuthUserFile /etc/apache2/passwd-svn
      Require valid-user
    </Location>

Restart Apache2

# invoke-rc.d apache2 restart

You should be able to reach TRAC at http://host.domain.tld/project1

thanks to
Sebastien Wains
http://www.wains.be

Howto based on http://trac.edgewall.org/wiki/TracOnDebianSarge

Advertisements