Now that I’ve installed Trac about 10 times over the past year, I find that I still get a little confused every time because the documentation is a bit haphazard. I’m going to go over things very simply, in one list, step-by-step so there’s no confusion next time I install. Hopefully this helps someone else.

Bad News

As of 09/29/2007, Mylyn will only integrate with Trac 0.9 or 0.10. If you install the latest dev version of 0.11, you won’t be able to get Mylyn to connect to the Trac repository. I use Trac 0.10

Install Trac

  1. Install Python 2.4.4
  2. Install ez_setup.py
  3. Via command line get to the Scripts directory of your Python installation and execute the following command:
    easy_install http://svn.edgewall.com/repos/trac/trunk/
  4. Execute the following command
    easy_install pysqlite
  5. Execute the following command:
    easy_install -Z http://subversion.tigris.org/downloads/svn-python-1.4.2.win32-py2.4.exe
  6. Create a directory at the root of the work drive named TracProjects
  7. Create a subdirectory for your first project
  8. Go back to your command prompt and execute the following command:
    trac-admin.py D:\\TracProjects\\{project directory} initenv
  9. Fill out project name, then defaults for the rest until asked for path to SVN repository. Fill that in.

Your Trac environment is now set up, but you need to install Apache to serve up the site for your project. Well, need is a strong word since Trac has a built-in server, but it’s only recommended for testing.

Install and Configure Apache

  1. Install Apache 2.2
  2. Download and install mod_python. Be sure to grab the right version for your Python/Apache versions: mod_python-3.3.1.win32-py2.4-Apache2.2.exe
  3. Add the following configuration to Apache
    LoadModule python_module modules/mod_python.so
  4. Add the following configuration to Apache
     <Location /projects>
        SetHandler mod_python
        PythonInterpreter main_interpreter
        PythonHandler trac.web.modpython_frontend
        PythonOption TracEnvParentDir D:\\TracProjects
        PythonOption TracUriRoot /projects
     </Location>
  5. Add the following configuration to Apache
     <LocationMatch "/projects/[^/]+/login">
        AuthType Basic
        AuthName "Trac"
        AuthUserFile D:\\TracProjects\\{project}\\{project}.htpasswd
        Require valid-user
     </LocationMatch>

Configure Apache Based Security

  1. Create the .htpasswd file, referenced in the previous step, by using Apache\bin\htpasswd.exe at the command line:
    htpasswd -c D:\\TracProjects\\{project}\\{project}.htpasswd {username}
  2. Add any additional users with the same command without the -c switch
    htpasswd D:\\TracProjects\\{project}\\{project}.htpasswd {username}

You’re all set at this point, just restart Apache so that the configuration changes and security take effect. After it restarts, try to hit your project URL.