from here

Software installation

All required packages are installed by the following command:

apt-get install lighttpd trac subversion apache2-utils</pre>
<p>We install lighttpd together with trac, as otherwise the trac
package will pull in an installation of apache2, which is a bit more
heavyweight than what I wanted.</p>
<h2>Setting up the directory tree</h2>
<p>Let’s set up a directory tree for trac:</p>
<pre>for p in env svn auth; do mkdir -p /srv/trac/$p/demo; done</pre>
<p>One directory for the trac environment data, another for the
subversion repository and the third for authentication data. Putting
all environments into a single directory (<tt>/srv/trac/env</tt>) would allow to run a single trac server for all environments using the <var>TRAC_ENV_PARENT_DIR</var> configuration variable.</p>
<h2>Creating a trac environment</h2>
<p>The trac environment is created using
</p><pre>trac-admin /srv/trac/env/demo initenv</pre>
<p>The command will ask interactively for the following settings:</p>
<ul><li>Project name: Enter a name as you like (”Demo”). Note that you can change this later.</li><li>Database connection string: You can accept the default sqlite database.</li><li>Repository type: I used the default “svn” selection.</li><li>Path to repository: <tt>/srv/trac/svn/demo</tt></li></ul>
<p>From now on, we can access the (empty) trac instance by running <code>tracd --port 8000 /srv/trac/env/demo</code>
and accessing the trac-integrated web server at port 8000 of the
server. Hit Ctrl-C to kill the tracd after you don’t need it any longer.</p>
<h2>Creating an initial user</h2>
<p>By default, trac creates no users. Only anonymous access is allowed,
which by default is read-only. Therefore, we have to create a user to
add content. Let’s use digest authentication:</p>
<pre>htdigest -c /srv/trac/auth/demo/users "trac demo realm" admin<br />trac-admin /srv/trac/env/demo permission add admin TRAC_ADMIN</pre>
<p>You can now start tracd with authentication:</p>
<pre>tracd --port 8000 \<br />    --auth=demo,/srv/trac/auth/demo/users,"trac demo realm" \<br />    /srv/trac/env/demo</pre>
<h2>Configure lighttpd</h2>
<p>To use lighttpd to serve the trac environment, we first need to fix the permissions:</p>
<pre>chown -R www-data /srv/trac/env<br />chmod +x /usr/share/pyshared/trac/web/fcgi_frontend.py</pre>
<p>I think, the second command should not be required and filed <a href="http://bugs.debian.org/510441">Debian bug #510441</a> because of this.</p>
<p>Next, we need a configuration file. It delegates the trac path to a
FastCGI handler and contains the location of the authentication data.
Copy the <a href="http://landschoff.net/trac/stuff/browser/misc/50-trac-demo.conf?rev=4">configuration file</a> to <tt>/etc/lighttpd/conf-available/</tt> and enable the configuration:</p>
<pre>lighty-enable-mod auth trac-demo<br />/etc/init.d/lighttpd force-reload

The trac instance should be available at http://HOSTNAME/trac. Have fun!

Automatic setup

For my own tests I wrote a script which does most of this automatically. Use at your own risk!

BTW: All of this was tested against Debian lenny (not released at time of writing).

Advertisements