Edgewall Software

Version 9 (modified by Ryan J Ollos, 7 years ago) ( diff )

Link is a dead-end and it appears that Trac is no longer packaged for RHEL.

Trac on RHEL

Installing Trac on RHEL 4+ is easy with the Yum package manager.

  1. If you haven't already installed Yum, do so as appropriate for your operating system.
  2. If you haven't registered the RPMforge repository with your installation of Yum, look at http://rpm.pbone.net and install the rpmforge-release package for your particular version of RHEL.
  3. Run the following command in a terminal window:
      $ sudo yum install trac
    Yum will take care of all dependencies on which the Trac package depends (including the python-clearsilver package) and install them for you automatically. Note: the mod_python dependency may be missing in RPMforge, so if you haven't already installed mod_python, you also need to do:
      $ sudo yum install mod_python
  4. Create a new project environment. An environment is basically a directory that contains a human-readable configuration file and various other files and directories.
    1. Create a Subversion repository if you don't already have one, for example in /srv/svn:
       $ sudo mkdir -p /var/www/svn/foobar
       $ sudo svnadmin create  --fs-type fsfs /var/www/svn/foobar
    2. Next you need to decide where to store your Trac project and create the directory, for example in the new directory /srv/trac:
       $ sudo mkdir -p  /var/www/trac
    3. Then create a new environment using trac-admin, as in this example for project foobar:
       $ sudo trac-admin /var/www/trac/foobar initenv
    4. Now make it owned by Apache:
       $ sudo chown -R apache:apache /var/www/trac/foobar
       $ sudo chown -R apache:apache /var/www/svn/foobar
  5. Next, you need to edit the file /etc/httpd/conf.d/trac.conf to point to your new project environment, as in this example (using mod_python):
    # The Location is the part after the host (http://example.com<Location>) that
    # you want to serve the Trac site
    <Location /trac>
       SetHandler mod_python
       PythonHandler trac.web.modpython_frontend
       # "/var/www/svn/foobar" is the folder you gave to trac-admin initenv earlier
       PythonOption TracEnv /var/www/trac/foobar
       # "/trac" is the same as the Location above
       PythonOption TracUriRoot /trac
       # "/tmp" should be some writable temporary directory
       SetEnv PYTHON_EGG_CACHE /tmp 
       # "trac" can be any string, but must be the same for all
       # Trac instances on the same Apache install
       PythonInterpreter trac
    <Location /trac/login>
       AuthType Basic
       AuthName "alexandria"
       AuthUserFile /var/www/trac/foobar/conf/trac.htpasswd
       Require valid-user

Apache Authentication

The example above assumes you have a Trac project environment setup in /var/www/trac/foobar/ directory, described in step 2 and an htpasswd file at /var/www/trac/foobar/conf/trac.htpasswd for authentication purposes. See also a generic guide at TracModPython.

There are other ways to authenticate users, but if you care about security do not use the same authentication for comand line Subversion clients as you do for Trac. This is because Subversion keeps its passwords for command lines locally, in your home directory, in clear text.

Activating the web server

You will need to tell Apache to reload configuration after editing trac.conf:

  $ sudo service httpd reload

Verify your Trac installation by pointing your browser at the correct URL for your Trac server, eg http://localhost/trac.

Notes on the RHEL package:

  • trac.cgi and trac.fcgi are installed in /var/www/cgi-bin/, or //usr/share/trac/cgi-bin/trac.fcgi for RHEL.
  • Apache webserver config file is installed in /etc/httpd/conf.d/trac.conf.

Also check the generic installation instructions in the TracGuide.


RHEL now ships with SELinux enabled by default. This means you need to make the Trac and Subversion directory accessible to the webserver. If you keep these contents under /var/www/trac and /var/www/svn, you don't need to do anything else.

If you want an alternative location, such as /srv or opt, and many installers have their own ideas about where these should go, follow these guidelines and read the notes at http://fedora.redhat.com/docs/selinux-apache-fc3/ for details.

 $ sudo chcon -R -t httpd_sys_content_t /srv/trac
 $ sudo chcon -R -t httpd_sys_content_t /srv/svn

If you put these under /srv/www/trac and /srv/www/svn instead, the restorecon command will know that these attributes should be preserved. Alternatively, you can teach restorecon about these two directories by adding these lines to the file /etc/selinux/targeted/contexts/files/filecontexts.local:

 /srv/trac(/.*)?    system_u:object_r:httpd_sys_content_t
 /srv/svn(/.*)?     system_u:object_r:httpd_sys_content_t

You may need to create this file, because it is not present by default.

Note: See TracWiki for help on using the wiki.