Woot - Trac up and running

August 23, 2006 · 21 Comment s

Here at work we've been using Subversion since I joined. There was no version control in place and it was the first change I made. For some time now I've wanted to get Trac up and running as I've seen it in action, and it's integration with Subversion is nothing short of astounding. Due to lack of time and resources, and because I heard Trac was a killer to set up on Windows, we went with Ray Camden's Lighthouse as our bug tracker until I could find a spare day or two. Well today I finally decided to bite the bullet and install Trac. And you know what, in about 30 mins, it was up and running... and even then most of that was downloading files. In fact, the only complication I had was forgetting to edit trac.cgi to find the python.exe file. So, whilst not an extensive guide to getting Trac installed here's what I did. Files to Download Bear in mind I already had Subversion up and running with Apache on Windows 2003, so I won't be covering this step
  1. Python
  2. Subversion Python Bindings
  3. PySQLite
  4. Clearsilver
  5. Trac
Installation Notes
  • Install Python - You must use Python 2.3.x - the Subversion bindings are not available for Python 2.4
  • Copy the libsvn and svn folders in the Python Bindings to <python>\lib\site-packages
  • Install PySQLite
  • Extract neo_cgi.pyd from your Clearsilver download to <python>\lib\site-packages
  • Install Trac
Configuration
  • Copy <python>\share\trac\cgi-bin\trac.cgi to <apache>\cgi-bin
  • Edit the trac.cgi file so that the first line points to your python.exe file
Configure Trac DB d:\python23>python scripts\trac-admin d:/svn/trac.db Initialise DB Trac [d:/svn/trac.db]> initenv Trac will now ask you for a Project Name, Database Connection String, Subversion Repository, and the Path to Templates So as an example: Project Name: Creative Connection String: (just hit enter to accept default) Subversion Repository: d:\svn\creative Path to Templates: (just hit return) Add Administrative Permissions Trac [d:/svn/trac.db]> permission add admin TRAC_ADMIN Add Trac to Apache Edit httpd.conf: # TRAC
Alias /trac <span class='cc_value'>"d:/Python23/share/trac/htdocs"</span>

<Location /cgi-bin/trac.cgi>
SetEnv TRAC_ENV <span class='cc_value'>"d:/svn/trac.db"</span>
SetEnv PYTHONPATH <span class='cc_value'>"d:/Subversion/bin"</span>
# if you are running Apache as a user other than System, the TMP variable
# needs to be set to a place where that user can write scratch files. Make
# sure that this directory is created and writable by that user.
# SetEnv TMP <span class='cc_value'>"d:/svn/trac.db/tmp
</Location>

<Location /cgi-bin/trac.cgi/login>
AuthType Basic
AuthName "
</span>Creative<span class='cc_value'>"
AuthUserFile passwd
Require valid-user
</Location>

<Directory "</span>
d:/Python23/share/trac/htdocs">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Now you want to restart Apache. Finally, hit http://yourdomain/cgi-bin/trac.cgi and log in via the username/password combinations you have set up in "passwd" for accessing Subversion. Final Words I know I've not covered everything, and I've certainly not mentioned any error messages you may potentially come across, but if you do have any issues, leave a comment here and I'll try and help out.

Tags: Trac · Subversion

21 response s so far ↓

  • 1 Christian Ready // Aug 24, 2006 at 5:00 AM

    This is great news! I just got done listening to CFWeekly and I thought I was going to have to find a Linux box to do all of this on. One question, though. Are you running apache 2.0 or a more recent version of Apache? I found I could only get SVN to work with Apache 2.0.x.

    I ask because I don't want to pull my hair out trying to get Trac to work only to find that I'm using the wrong version of Apache.
  • 2 Andy Allan // Aug 24, 2006 at 10:24 AM

    Currently running 2.0.54 ... I'm sure there was a mention of some sort of complication if trying to use 2.2 - I'll see if I can dig out that it was.
  • 3 Stephen Moretti // Aug 24, 2006 at 10:59 AM

    I think Apache 2.2 is still considered to be bleeding edge and not really production ready, so probably best to use 2.0.58. Of course, I could be completely wrong. ;)
  • 4 Andy Allan // Aug 24, 2006 at 11:41 AM

    Yes, you are wrong Moretti ... Or should I call you Jeanette :p (inside joke)
  • 5 Christian Ready // Aug 24, 2006 at 3:22 PM

    Ok, sounds good. I'm glad I'm using the right version of Apache, then :)
  • 6 Rob Wilkerson // Aug 25, 2006 at 1:09 PM

    I recently brought my organization up on Trac+Subversion on a Linux box and, I have to say, it might be the first application in history to be an easier on Linux than on Windows. I consider myself a Linux enthusiast, but I'm nowhere close to being an expert. I just installed Apache (of course), Subversion and Trac through the yum RPMs and everything just worked. I'm not sure I can say that's ever happened for me in a linux environment.

    To share some of what I've learned, the only Apache conflict is on Windows. My Linux install is running on Apache 2.2.2 just fine. From what I understand, the Windows mod_python release doesn't play nice with Apache 2.2.x on Windows yet.

    This is a great system. I love Subversion (we were using VSS) and Trac has been a huge productivity tool. Even removing the integrated ticketing from this thought, the wiki availability for collaborative documentation is outstanding. I couldn't be happier with what we've gotten out of it in just a few short weeks.
  • 7 pinxo // Nov 8, 2006 at 12:05 PM

    That does not work on my apache 2.2.3, I get this error:
    access to /trac/myproject/login failed, reason: require directives present and no Authoritative handler.

    Any hints?
  • 8 Andy Allan // Nov 8, 2006 at 12:19 PM

    The Subversion bindings linked to above do not work with Apache 2.2 ... it states that on the bindings download page :)
  • 9 pinxo // Nov 8, 2006 at 2:35 PM

    Everything works fine, I just forgot to enable the apache module authz_user!
    btw: I'm using Debian Etch and the bindings works fine.
  • 10 Andy Allan // Nov 8, 2006 at 2:41 PM

    Interesting ... I may have to set up a vmware instance and try it out with apache2.2 ... if all goes well, i'll upgrade.
  • 11 Rob Wilkerson // Nov 8, 2006 at 2:51 PM

    See my comment above. The bindings problem (mod_python) is only a problem for Windows installs. They work fine on Linux. I run Apache 2.2.2 on a FC5 box and have never had a problem.
  • 12 Ali Muzaffar Khan // May 18, 2007 at 12:58 PM

    You can install SVN on Apache 2.2 its an easy task if anyone needs help contact me. I don't know about trac i am wrestling wih it at the moment ;)
  • 13 Dave Shuck // May 24, 2007 at 6:48 PM

    First off, thanks for the Windows instructions. What a pain in the ass it is compared to installing on Linux!

    I walked all the way through the instructions without error, but when I went to the browser and hit the page I got an apache error. When looking through the logs, I found this:
    __________
    [Thu May 24 11:57:10 2007] [error] [client 216.50.229.162] C:/Program Files/Apache Group/Apache2/cgi-bin/trac.cgi is not executable; ensure interpreted scripts have &quot;#!&quot; first line
    [Thu May 24 11:57:10 2007] [error] [client 216.50.229.162] (9)Bad file descriptor: don't know how to spawn child process: C:/Program Files/Apache Group/Apache2/cgi-bin/trac.cgi
    __________
    On the first line of the trac.cgi. I have...
    #!C:\Python23\python.exe
    ... which is the correct path to the python.exe Is there something obvious that I am missing here?
  • 14 Dave Shuck // May 24, 2007 at 7:19 PM

    After some IM chatting with Rob Wilkerson (above), I looked at the possiblity of non-printable characters getting in the way. I opened trac.cgi and did &quot;Save as&quot;, choosing ANSI rather than UTF-8. When it overwrote the original file, everything worked.

    yay!
  • 15 Thijs Kruithof // Jul 29, 2007 at 5:53 PM

    Thanks for the info Dave. I had exactly the same problem as you had :) Thnx! It works fine now.
  • 16 SEo Companies // Aug 6, 2009 at 8:55 AM

    I subscribed to your blog when is the next post
  • 17 Transition management // Aug 6, 2009 at 1:49 PM

    Thanks for such a nice post.

    Regards

    Harry
  • 18 blank calendar // Aug 8, 2009 at 9:11 AM

    i would love to read more from you on this

    thanks
    Zane
  • 19 rubbish clearance // Aug 11, 2009 at 5:03 PM

    Great Work !
  • 20 swimming pools designs // Aug 28, 2009 at 9:53 AM

    I needed this info thanks mate
  • 21 ed hardy mens Jeans // Sep 17, 2009 at 9:06 AM

    Thank you!

Leave a Comment

Leave this field empty: