Debian Tutorials

Debian Tutorials


Step by step tutorials showing you how to install and configure various applications and services on Debian based Linux distros.

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories


Setup Trac and Subversion

adminadmin

Setup Trac and Subversion

First install packages for both Trac and Subversion. We’ll be using Apache to publish the Subversion repositories
apt-get install python-setuptools trac subversion libapache2-svn

Create the SVN repository directory structure, used to create new repositories later
mkdir /var/svn/
mkdir /var/svn/tmpproject
mkdir /var/svn/tmpproject/branches
mkdir /var/svn/tmpproject/tags
mkdir /var/svn/tmpproject/trunk

Enable the Apache SVN module

a2enmod dav_fs

Create a password file containing users that have access to the Subversion repositories and Trac
htpasswd -c /etc/apache2/svn.passwd user1
htpasswd /etc/apache2/svn.passwd user2

Edit the apache configurations to enable Trac and Subversion SVN (pico /etc/apache2/sites-enabled/000-default). Add the following lines:
<Location /svn>
DAV svn
SVNParentPath /var/svn
SVNAutoversioning on
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/svn.passwd
Require valid-user
</Location>

<Directory “/usr/share/trac/htdocs”>
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

Alias /trac “/usr/share/trac/htdocs”
Create a directory for Trac projects
mkdir /var/trac

Create projects

Subversion repository
svnadmin create /var/svn/myproject --fs-type fsfs
svn import /var/svn/tmpproject file:///var/svn/myproject -m "initial import"
find /var/svn/myproject -type f -exec chmod 660 {} \;
find /var/svn/myproject -type d -exec chmod 2770 {} \;
chown -R root.www-data /var/svn/myproject

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

Configure Apache to publish the new project (pico /etc/apache2/sites-enabled/000-default). Add the following lines:
ScriptAlias /projects/myproject /usr/share/trac/cgi-bin/trac.cgi
a
<Location "/projects/myproject">
SetEnv TRAC_ENV "/var/trac/myproject"
</Location>
 
<Location "/projects/myproject">
AuthType Basic
AuthName "Trac - myproject"
AuthUserFile /etc/apache2/svn.passwd
Require valid-user
</Location>

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

Give a user administrator permissions to the project
trac-admin /var/trac/myproject
permission add user1 TRAC_ADMIN

You can now access your Trac project by browsing with your favorite browser to http://localhost/projects/myproject.

To access the Subversion repository you can use any Subversion client. If you’re using Windows, TortoiseSVN would be a good choice.

Comments 3
  • Nagilum
    Posted on

    Nagilum Nagilum

    Author

    Sadly this doesn’t work (anymore?).
    The paths are not correct (/usr/share/pyshared/trac/htdocs) and I can’t locate a trac.cgi :/

    Thx anyways


  • drmike
    Posted on

    drmike drmike

    Author

    No trac.cgi here either. It’s also kind of hard to realize what needs to be changed for local setups. Is user1 specifically needed or can I pick my own name as well?

    After the initenv line, the script started asking me questions and I had to pretty much guess at the answers.

    Not sure where within the 000-default I;m supposed to add in those lines either. I’m assuming tat they go between the VirtualHost lines but not sure if they need to be within a specific place within the file structure.

    I don’t see anything about the database either.


  • Stephan Eberle
    Posted on

    Stephan Eberle Stephan Eberle

    Author

    use “trac-admin /var/trac/myproject delpoy /usr/share/trac” to deploy the cgi scripts. It should work then.