Setup Trac on Windows

Using Bitnami Trac Stack + Subversion (SVN).

    1. Setup environment
      • Download Bitnami Track Stack (Windows installer) & install it
      • Add to PATH
        C:\Program Files\BitNami Trac Stack\python\Scripts
        C:\Program Files\BitNami Trac Stack\apache2\bin
    2. Create new project
      • Cmd
        $ trac-admin <trac env path> initenv
      • path: C:\Users\Username\Projects\Trac\newproject
    3. Configure SVN repo
      • Edit C:\Users\Username\Projects\Trac\newproject\conf\trac.ini
        repository_dir = <svn repo path>
      • path: C:\Users\Username\Projects\Repos\newproject (create using TortoiseSVN)
    4. Enable SVN module in Trac
        • Edit trac.ini

          [components]
          tracopt.versioncontrol.svn.svn_fs.subversionconnector=enabled
          acct_mgr.*=enabled
  • Edit logo image
    • Edit trac.ini
      [header_logo]
      src = site/logo.png
    • Place image in <trac env path>\htdocslogo.png
  • Enable syntax highlighting
    • Install pygments
      # easy_install pygments
    • Edit trac.ini
      [mimeviewer]
      pygments_default_style = default
  • Add admin permission
    • Cmd
      $ trac-admin /path/to/projenv permission add admin TRAC_ADMIN
    • /path/to/projectenv = c:\Users\Username\Projects\Trac\newproject
  • Add user
    • Cmd
      # htdigest -c htpasswd "Trac" username
    • -c = Create auth file (exclude when adding user)
      htpasswd = C:\Users\Username\BitNami Trac Stack\apps\trac\users\htpasswd
      “trac” = realm in http-dav-svn.conf below
  • Enable SVN repo hosting on Apache
    • Add in httpd.conf
      # svn repository
      Include conf/extra/http-dav-svn.conf
    • Create http-dav-svn.conf (copied from subversion.conf at http://noodlecode.net/2010/11/06/apache-svn-on-fedora/)
    • Edit:
      SVNParentPath C:\Users\Username\Projects\Repos
      AuthType Basic
    • AuthName & AuthUserFile follow values in c:\Program Files\BitNami Trac Stack\apps\trac\conf\trac.conf
      * bitnami trac by default is using basic auth

Trac can be accessed at http://localhost/trac. Checkout & commit to SVN repo at http://localhost/svn

Trac on Fedora

This is multiple projects installation, a continuation from previous posts.

Install required packages:

yum install trac mod_wsgi

Software: Trac 0.11.7, mod_wsgi 2.3

Trac folder: /var/svn/trac
Python eggs cache dir: /tmp/egg-cache

Create new trac environment

trac-admin /var/svn/trac/testproj initenv
  Project Name > Test Project
  Database connection string > [sqlite:db/trac.db]
  Repository type > [svn]
  Path to repository > /var/svn/repos/testproj

Create wsgi script

vim /var/svn/trac/trac.wsgi
#!/usr/bin/env python
import os
def application(environ, start_request):
  os.environ['TRAC_ENV_PARENT_DIR'] = '/var/svn/trac'
  os.environ['PYTHON_EGG_CACHE'] = '/tmp/egg-cache'
  from trac.web.main import dispatch_request
  return dispatch_request(environ, start_request)

Apache mod_wsgi settings

vim /etc/httpd/conf.d/trac.conf
# comment all settings in /etc/httpd/conf.d/wsgi.conf
LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias /trac /var/svn/trac/trac.wsgi
<Directory /var/svn/trac>
  WSGIApplicationGroup %{GLOBAL}
  Order deny,allow
  Allow from all
</Directory>
<LocationMatch "/trac/[^/]+/login">
  AuthType Digest
  AuthName "Project Repository"
  AuthUserFile /var/svn/auth
  Require valid-user
</LocationMatch>

Grant administration right to admin user (trac>=0.11)

trac-admin /var/svn/trac/testproj permission add user1 TRAC_ADMIN

Set ownership

chown -R apache.apache /var/svn

Reload apache

service httpd reload

View list of projects – http://localhost/trac