Edgewall Software

Version 77 (modified by svenfuchs@…, 19 years ago) ( diff )

Added a note that trac db != svn repository

Windows Installation Instructions for Subversion w/Trac 0.8.1

Versions used in this example (Avail 2005-03-11):

PLEASE UPDATE THIS WIKI PAGE IF YOU FIND IT IS DIFFERENT FROM YOUR EXPERIENCE: IF YOU HAVE ANY PROBLEMS, I WOULD ALSO SUGGEST POSTING THE RESOLUTIONS HERE FOR THE COMMON GOOD Please reference the version number you are having difficulties with, but assume that readers will be using the latest version (and issues from previous versions can disappear into wiki history) Contributors: please add your name to the list at the end - Thanks in advance!

Added some information to help install Trac version 0.8. The docs should be OK. Contact Muir for questions. For Subversion issues on Windows see the TortoiseSVN site, particularly the server section.

Trac running on Microsoft's Internet Information Server (IIS) is highly experimental. See #697.

Trac running without Apache or IIS: using tracd and svnserve is experimental (tracd) but the performance improvement is very significant over cgi. See TracOnWindowsSansApacheOrIis (TBD).

Learn Subversion

  1. Get & Read Version Control with Subversion

Install Subversion Pre-Requisites

  1. Install Python
    Add C:\Python23 to the path
  1. Install Apache
  1. Install Subversion
  1. Install docutils
      expand and run from the expanded docutils-xxx directory
      > C:\python23\python install.py
    

Create Repository

  1. Create repository directory
    C:\> md c:\svn
    
  1. Create repository
    C:\> svnadmin create --fs-type=fsfs c:\svn\repo1
    

FSFS should be the preferred Subversion Repository filesystem on Windows. The Python bindings are much more reliable in that case — ChristianBoos

  1. Create skeleton repository structure in c:\temp\project Example:
    /project
      /vendor
        /tags
        /trunk
          files
      /projectname
        /branches
        /tags
        /trunk
          files
    
  1. Build repository tree
    C:\> svn import c:\temp\project file:///c:/svn/repo1 -m "Initial Load"
    
  1. Create local sandbox
    C:\> svn checkout file:///c:/svn/repo1 c:\project
    

Configure Apache

  1. Copy files
    C:\> copy c:\progra~1\subver~1\httpd\*.* c:\progra~1\apache~1\apache2\modules
    

You may also need to manually transfer the DLL files from the Subversion installation directory. If the Apache service will not start, or reports an error loading mod_dav_svn.so, you will need to do this. They contain, among other things, the Berkeley DB. This is all you need to do for the DLLs:

C:\> copy c:\progra~1\subver~1\bin\*.dll c:\progra~1\apache~1\apache2\modules
  1. Create password file (w/user 'admin')
    C:\> c:\progra~1\apache~1\apache2\bin\htpasswd -cm c:\svn\.htaccess admin
    
  1. Configure Apache (edit httpd.conf) 13.1. Restrict access/lockdown as appropriate

13.2. Add Modules to httpd.conf

13.1.1. Uncomment:

LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so

13.1.2. Add (after):

# Subversion
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

13.1.3. Install Apache as Service (IF NOT WORKING when installed to C:)

C:\Progr~1\Apache~1\Apache2\bin\Apache -k install -n "Apache2"

13.3. Add location root for multiple repositories

# Subversion
<Location /svn>
  DAV svn
  # any /svn/foo URL will map to a repository C:/svn/foo
  # I've only got it working using SVNPath!!
  SVNParentPath C:/svn
  AuthType Basic
  AuthName "Subversion repository"
  AuthUserFile c:/svn/.htaccess
  Require valid-user
</Location>

13.4. Add cgi handler, Uncomment:

AddHandler cgi-script .cgi

  1. Restart Apache
  1. Test your install of Subversion http://[hostname]:80/svn/repo1

Create Users

  1. Add users to password file
    C:\> c:\progra~1\apache~1\apache2\bin\htpasswd -m c:\svn\.htaccess user
    

Install Trac Prerequisites

(Please note: pay attention to download exactly the versions mentioned here. Do not simply download the latest stable versions. Otherwise you will probably run into several issues.)

  1. Install Subversion Python Bindings Download svn-win32-1.1.X_py.zip from the Subversion site.
    Extract and copy the libsvn and svn directories to C:\Python23\Lib
  1. Install SQLite http://www.sqlite.org
    Copy sqlite.exe to C:\Program Files\SQLite This is really optional. Don't let it mess your disk unless something exceptional not described here happens.
  1. Install PySQLite http://pysqlite.org/
    Download and install pysqlite-1.1.6.win32-py2.3.exe
  1. Install ClearSilver http://www.clearsilver.net download clearsilver_python-0.9.12-win32.zip
    Copy neo_cgi.pyd into C:\Python23\Lib\site-packages
  1. Install Trac http://www.edgewall.com/products/trac/
    python ./setup.py install
    

Fix a few things

  1. Copy CGI
    C:\> copy d:\python23\share\trac\cgi-bin\trac.cgi c:\progra~1\apache~1\apache2\cgi-bin
    

  1. Fix the errors from the Trac Windows Installer (version 0.8.1)

The Windows installer installs siteconfig.py file in PYTHONLIB/site-packages/trac which contains absolute paths pointing to F:\. You will need to fix these paths so that they start with the installation directory of the version of Python you selected during setup.

23.1 Fix the cgi-script c:\progra~1\apache~1\apache2\cgi-bin\trac.cgi

Make sure the path to your python directory is correct. The Trace installer, sets this to:

!#F:\PYTHON23\python.exe

Configure Trac DB

The trac database can be named to match the subversion repository it is working with, which is especially useful if more than one repository will ever be created. In this example "trac.db" would read as "repo1.db"

  1. Run trac-admin
    C:\Python23\Scripts> python trac-admin c:/svn/trac.db
    
  1. Initialize DB
    Trac [c:/svn/trac.db]> initdb
    

or

Trac [c:/svn/trac.db]> initenv
  Enter project name
    Project
  Enter path to repository
    c:\svn\repo1
  Enter path to templates
    c:\Python23\share\trac\templates

If you get an error here stating that libdb42.dll was not found, copy [SVN PATH]\bin\libdb42.dll to [PYTHON PATH]\lib\libsvn\, then try again.

To get this step done the right way, you have to understand that the trac database is not the svn repository.

For expample if you have your svn repository located in c:\svn\repo1 (like supposed by this tutorial), you'll probably want to name your trac database c:\trac\repo1. You would then call "python trac-admin c:/trac/repo1" in your scripts directory and enter "c:\svn\repo1" as the "path to (svn) repository".

  1. BUG Load Wiki
    Trac [c:/svn/trac.db]> wiki load c:/python23/share/trac/wiki-default
    
  1. Add administrative permissions (the below adds all permissions for 'admin' user)
    Trac [c:/svn/trac.db]>
    
    permission add admin TRAC_ADMIN
    

Add Trac to Apache

  1. Edit httpd.conf: Add: (copy this - there's a typo in Edgewall's version)
    # TRAC
    Alias /trac "C:/Python23/share/trac/htdocs"
    
    <Location "/cgi-bin/trac.cgi">
      SetEnv TRAC_ENV "c:/svn/trac.db"
    </Location>
    
    <Location "/cgi-bin/trac.cgi/login">
      AuthType Basic
      AuthName "Project"
      AuthUserFile C:/svn/.htaccess
      Require valid-user
    </Location>
    
    <Directory "C:/Python23/share/trac/htdocs">
      Options Indexes MultiViews
      AllowOverride None
      Order allow,deny
      Allow from all
    </Directory>
    

Alternatively you could set up the authorisation to use your NT domain login if you are running an NT Domain. This bit of Apache config replaces the <Location "/cgi-bin/trac.cgi/login"> given above.

<Location "/cgi-bin/trac.cgi/login">
  #NT Domain auth config
  AuthType SSPI
  SSPIAuth On
  SSPIAuthoritative On
  SSPIOfferBasic On 
  # following line squishes bug #1168 if IE has troubles editing wiki pages.   
  SSPIBasicPreferred On 
  AuthName "Project"
  Require valid-user
</Location>

You'll also need the sspi_auth_module on your system and loaded like this…

LoadModule sspi_auth_module modules/mod_auth_sspi.so

You must download and install this module. It can be found here: http://tortoisesvn.tigris.org/mod_auth_sspi.zip

Or compile it into Apache. Note when adding permissions and authenticating against a domain you may need to use the following syntax complete with quotes as seen in #1055.

  • permission add "DOMAIN\username" TRAC_ADMIN

Note: Internet Explorer may be in trouble with an Apache server running SSPI authentication. See #1343

  1. Restart Apache.
  1. Hold your breath, test Trac install http://[hostname]:80/cgi-bin/trac.cgi

If it doesn't work, then running Apache from the command-line will give you a few clues.

If your page seems to be lacking stylesheets, please check the alias of /trac in apache. Otherwise you've probably run into a known Apache bug described (and worked around) here.

Optional Diffutils

  1. In order for Trac to display diffs, you must download and install diffutils. After installing diffutils, you will need to add the path to the diff executable to the Windows PATH environment variable and reboot the machine.

Finally…

  1. Install Subversion clients as necessary (try RapidSVN , TortoiseSVN or Subclipse)
  1. Don't forget to lock down the security on the box!
  1. If the svn page would not work properly with saying that DLL is missing, then copy the three DLL's - libdb42.dll - libeay32.dll - ssleay32.dll from your [Subversion]\bin directory to your system directory (most likely C:\Windows\system32).

In addition…

  1. In order to use pre- and post-commit hooks with Subversion on Windows, please refer to diff files described in #897, as the changes are not commited into the trunk as of version 0.8-dev.

And Then…

  1. Give yourself a pat on the back and a drink in the hand

Contributors:

Attachments (2)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.