Jaime Frutos Morales's blog


How to install and configure Trac using Apache and a Subversion backend in Ubuntu 9.10

Filed under: SysAdmin, Ubuntu — acidborg @ 13:34

Description: “Trac is an enhanced wiki and issue tracking system for software development projects. Trac uses a minimalistic approach to web-based software project management. Our mission is to help developers write great software while staying out of the way. Trac should impose as little as possible on a team’s established development process and policies. It provides an interface to Subversion (or other version control systems), an integrated Wiki and convenient reporting facilities. Trac allows wiki markup in issue descriptions and commit messages, creating links and seamless references between bugs, tasks, changesets, files and wiki pages. A timeline shows all current and past project events in order, making the acquisition of an overview of the project and tracking progress very easy. The roadmap shows the road ahead, listing the upcoming milestones“.


  • Install Trac and Subversion: apt-get install trac subversion apache2 libapache2-mod-python
  • Create a directory for the Subversion repository: mkdir svn-trac
  • Create the Subversion repository: svnadmin create svn-trac
  • Create the Trac environment: trac-admin trac initenv
  • Something like this will be shown:

    Creating a new Trac environment at /home/acidborg/trac

    Trac will first ask a few questions about your environment in order to initialize and prepare the project database.

    Please enter the name of your project. This name will be used in page titles and descriptions.

    Project Name [My Project]> My Trac

    Please specify the connection string for the database to use. By default, a local SQLite database is created in the environment directory. It is also possible to use an already existing PostgreSQL database (check the Trac documentation for the exact
    connection string syntax).

    Database connection string [sqlite:db/trac.db]> sqlite:db/trac.db

    Please specify the type of version control system, By default, it will be svn.

    If you don't want to use Trac with version control integration, choose the default here and don't specify a repository directory in the next question.

    Repository type [svn]> svn

    Please specify the absolute path to the version control repository, or leave it blank to use Trac without a repository. You can also set the repository location later.

    Path to repository [/path/to/repos]> /home/acidborg/svn-trac

    Creating and Initializing Project
    Installing default wiki pages
    Project environment for 'My Trac' created.

    You may now configure the environment by editing the file:


    If you'd like to take this new project environment for a test drive,
    try running the Trac standalone web server `tracd`: tracd --port 8000 /home/acidborg/trac

    Then point your browser to http://localhost:8000/trac.
    There you can also browse the documentation for your installed
    version of Trac, including information on further setup (such as
    deploying Trac to a real web server).

    The latest documentation can also always be found on the project
    website: http://trac.edgewall.org


Configuration (using the Apache web server):

  • Give the ownership of svn-trac and trac to the Apache user and group: chown -R www-data:www-data svn-trac trac
  • Give the proper rights on svn-trac and trac to the apache user and group: chmod -R 770 svn-trac trac
  • Create the configuration file to run Trac on Apache ( /etc/apache2/conf.d/trac ) with the following content (replace [ and ] for angle brackets):

    [Location /trac]
    SetHandler mod_python
    PythonHandler trac.web.modpython_frontend
    PythonInterpreter main
    PythonOption TracEnv /home/acidborg/trac
    PythonOption TracUriRoot /trac
    SetEnv PYTHON_EGG_CACHE /tmp
    [Location /trac/login]
    AuthType Basic
    AuthName "TRAC User Authentication"
    AuthUserFile /etc/.trac.htpasswd
    Require valid-user

  • Create a user for Trac (acidborg in this case): htpasswd -c /etc/.trac.htpasswd acidborg
  • Give the proper permissions to that file: chmod 640 /etc/.trac.htpasswd && chown root:www-data /etc/.trac.htpasswd
  • Restart Apache: apache2ctl restart
  • Give the new user writing permission in the Trac environment: trac-admin /home/acidborg/trac permission add acidborg authenticated

You can configure the look & feel and many other preferences of your Trac editing the file trac.ini in your Trac environment (/home/acidborg/trac/conf/trac.ini in this example).

Blog at WordPress.com.

%d bloggers like this: