Monday, March 2, 2009

Trac + Subversion installation on Windows

Here I'll describe a 20 minute procedure of Trac + Subversion (the latest versions) installation for 32 bit Windows (successfully tested under Windows XP and Windows 2003 Server). It's really simple and straightforward.

I assume the following directory structure (my project is called "rw"):


Well, let's get started!

1. Subversion server setup

There are two ways to install SVN server. I tried both of them and both work fine, so it's up to you which one to choose.

1.1.1. Download VisualSVN server
1.1.2. Download SVN binaries (also see complete downloads list)
1.1.3. Download Python bindings for Subversion (at the same place)
1.1.4. Install VisualSVN to any location, set repositories location to d:\projects\repos (you can accept defaults for all other options)
1.1.5. Create a repository (you can use management console for this) named "rw" and check a special checkbox to create a standard folder structure (trunk, tags, etc)
1.1.5. Create a new user for accessing repository. Now you can browse it using this URL and newly created login: https://localhost:8443/svn/rw/


1.2.1. Download SVN server from (also see complete downloads list)
1.2.2. Download Python bindings for Subversion (at the same place)
1.2.3. Unzip SVN server to d:\projects\tools, optionally add its bin folder to PATH
1.2.4. Create a repository named "rw" (svnadmin create d:\projects\repos\rw) and create a standard folder structure (trunk, tags, etc) manually
1.2.5. Create a new user for accessing repository (modify D:\projects\repos\rw\conf\passwd and uncomment a line in D:\projects\repos\rw\conf\svnserve.conf). Now you can browse it using this URL and newly created login: svn://localhost/rw/
1.2.6. You can start the server like this: svnserve.exe -r d:\projects\repos -d

TODO: See how it can be tunelled through HTTPS, also see how it can be run as a service.

2. Trac setup

2.1. Download Trac for windows installer (see complete downloads section)
2.2. Download Python 2.5 installer (details here, if needed)
2.3. Download genshi installer for Python 2.5
2.4. Download setuptools (instructions available here)
2.5. Install Python, for example to d:\Python25
2.6. (Optionally) add d:\Python25 to PATH system environment variable
2.7. Install setuptools, genshi and Trac to default locations

3. Integration with Subversion (this solution is kinda ugly hack. I assume it could be achieved much easier, though I was unable to find how exactly):

3.1. Unzip to d:\Python25\Lib\site-packages
3.2. Unzip\svn-win32-1.5.5\bin to d:\Python25\Lib\site-packages\libsvn
3.3. copy d:\Python25\Lib\site-packages\libsvn\*.dll d:\Python25\Lib\site-packages\libsvn\*.pyd
3.4. mkdir d:\projects\trac\rw
3.5. Execute this: trac-admin d:\projects\trac\rw initenv, enter the project name and d:\projects\repos\rw when asked for Subversion repository location. Leave all other values default.
3.7. To test installation just execute this: tracd --port 8000 d:\projects\trac\rw

4. Setup authentication (see instructions)

4.1. Create a new file named and fill it with code from this page
4.2. Create an administrator user (user "adm" with password "adm"): python -u adm -p adm >> d:\projects\trac\rw\digest.txt
4.3. Give that user all permissions: trac-admin d:\projects\trac\rw permission add adm TRAC_ADMIN
4.4. Run this to test everything: tracd -p 80 --auth=rw,trac\rw\digest.txt,trac trac\rw

Now you should be able to see the Admin tab if you log in with "adm" / "adm" (see http://localhost/rw)

4.5. Adjust attachment limit in trac.ini:

max_size = 262144000

(it's 250 Mb)

5. Enable automatic ticket control via Subversion comments. See instuctions:
Download trac-post-commit-hook and trac-post-commit-hook.cmd from here and follow instructions in trac-post-commit-hook.cmd.
Place it to d:\projects\repos\rw\hooks and modify .cmd file like that:
SET TRAC_ENV=D:\projects\trac\rw

6. Update. Use Subversion authentication in Trac.
Using AccountManagerPlugin we can work with Trac users fast and easy. I'll describe the simplest and unsecure way of setting it up.

6.1. easy_install
6.2. Go to Trac Admin tab and enable Account Manager Plugin and the following modules:
  • AccountManagerAdminPage
  • AccountManager
  • AbstractPasswordFileStore
  • HttpAuthStore
  • AccountChangeListener
  • AccountChangeNotificationAdminPanel
  • SvnServePasswordStore
  • AccountModule
  • LoginModule
  • RegistrationModule
(it will make your life much easier allowing not to login into that Windoze box to change some passwords).
6.3. Now you'll need to add the following line to [components] section of trac.ini (it will disable HTTP authentication):
trac.web.auth.LoginModule = disabled
6.4. Go to Accounts / Configuration (see left menu in Admin mode) and enter your passwd filename into SvnServePasswordStore box (i. e. D:\projects\repos\rw\conf\passwd)
6.5. Now you can login as adm (don't forget to add this user to your Subversion's passwd file) and add / remove Trac users via new menu items in Admin tab. The best thing about it is that now all your changes will be reflected in Subversion configuration, so this could be considered as the common place of manipulating users for your development environment.
6.6. IMPORTANT. Now you can't use --auth when starting tracd. So, my command line is simply tools\Python25\Scripts\tracd.exe -p 80 trac\rw

Now you can customize all the necessary settings, first of all authorization. Also there available a lot of useful plugins for Trac, see Trac hacks site. What I'm going to do next is install Maven proxy and Hudson continuous integration solution.

P.S. The best thing about this installation is that it can be done once and then packed into a handy (in my case 80 Mb) redistributable ZIP file and use it everywhere. The only issue in this case is that you will need to install Python anyway (because of some shared DLLs), but during installation you can choose the existing D:\projects\tools\Python25 directory and it won't override your changes.


  1. Hey There,

    Does this walkthrough work for the latest version of Visual SVN and Trac ? :)


  2. By the time I was writing this post, I used the latest versions of both tools. Frankly speaking, now I'd do it a bit different.

  3. Hi,

    In step 4.4 I am getting a "socket.error: (10013, permission denied)" error...

  4. I'd suggested you checking your firewall, if any. Try running trac with your firewall disabled.

  5. Or check if something else is listening on this port. Just go to your browser and try accessing http://localhost/

  6. As for now I'm doing such installations quick and easy by using BitNami stacks. Their Trac stack (see includes Subversion, so there is no good reason for installing it manually nowadays.

  7. Interesting and important information. It is really beneficial for us. Thanks Window Installation Melbourne