Trac, SVN quick howto on a linux Debian

In the following, I will present a mini guide to setup Trac 0.10.3 and SVN services on a Linux Debian stable.

I needed a per project authentication both in trac and in svn.

I just finished it, seems to be working, will check it out in a few days, hope it does not burn your PC 🙂 and that I did not forget anything crucial.
Careful when copy pasting code, the double quotes get messed up.

TRAC Installation

% apt-get install trac
% apt-get install libapache2-mod-python2.4
% sudo mkdir /var/lib/trac
% sudo chown www-data:www-data /var/lib/trac

In apache ( for example in /etc/apache2/sites-available/default ) <-you should create a separate file for trac.

ACCESS TRAC through apache

<Location /projects> #set up Trac handling
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /var/lib/trac
PythonOption TracUriRoot /projects
</Location>

SVN

% sudo apt-get install libapache2-svn subversion #not sure if anything else is needed
% sudo mkdir /var/lib/svn
% sudo mkdir /var/lib/svn/MyProject
% sudo svnadmin create /var/lib/svn/MyProject
% sudo svn mkdir file:///var/lib/svn/MyProject/branches file:///var/lib/svn/MyProject/tags file:///var/lib/svn/MyProject/trunk -m "initial structure"
% sudo chown -R www-data /var/lib/svn/MyProject
% sudo chown -R www-data /usr/share/trac
% sudo apache2 -k restart

TRAC – Create a new Project/add apache authentication to it

% sudo trac-admin /var/lib/trac/MyProject initenv
#The previous command asks some basic questions,leave them as they are, they should work except svn repository is located at /var/lib/svn/MyProject
% sudo chown -R www-data:www-data /var/lib/trac/MyProject

% htpasswd -c /var/lib/trac/MyProject/.htpasswd admin
enter new password:

The following goes to /etc/apache2/sites-available/default to order apache to use .htpasswd

<Location /projects/MyProject>
AuthType Basic
AuthName "MyProject"
AuthUserFile /var/lib/trac/MyProject/.htpasswd
Require valid-user
</Location>

SVN Access via Apache in /etc/apache2/sites-available/default
Add Authentication for MyProject SVN access


<Location /svn>
DAV svn
SVNListParentPath on
SVNParentPath /var/lib/svn/
</Location>
<Location /svn/
MyProject>
AuthType Basic
AuthName "MyProject Subversion repositories"
AuthUserFile /var/lib/trac/MyProject/.htpasswd
Require valid-user
</Location>

Restart apache and cross your fingers.

The trac server should be available in http://foor.bar/projects/
It should have one project named MyProject.

The SVN server should be available through webdav (TortoiseCVS works) through the URL http://foo.bar/svn
It should have one project named MyProject.

Both should eb authenticated using admin and the password you specified.

:wq

Pin It

Comments are closed.