Edgewall Software

Version 84 (modified by figaro, 8 years ago) ( diff )

Cosmetic changes

Trac on Fedora Core

Installing Trac On Fedora Core 4 (and higher), and also on RHEL 4 or higher is easy with Yum and involves the following steps:

  1. Verify you have configured Yum to use the Extras repository, which is enabled by default in Fedora Core 4 and higher, and run the following command in a terminal window:
  $ sudo yum install trac mod_python mod_dav mod_dav_svn

Yum will fetch and install all dependencies on which the Trac package depends, including the python-clearsilver package.

NOTE: If you are on Fedora 7 and using SQLite as the database, you will need to also install python-sqlite2.

  1. Create a new project environment: a directory that contains a human-readable configuration file and other files and directories.

Create a subversion repository if you don't already have one, for example in /srv/svn:

 $ sudo mkdir -p /srv/svn
 $ sudo svnadmin create  --fs-type fsfs /srv/svn

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  /srv/trac

Then create a new environment using trac-admin, as in this example for project foobar:

 $ sudo trac-admin /srv/trac/foobar initenv

Now make it owned by Apache:

 $ sudo chown -R apache /srv/trac
 $ sudo chown -R apache /srv/svn
  1. 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
   # "/srv/trac/foobar" is the folder you gave to trac-admin initenv earlier
   PythonOption TracEnv /srv/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
   # Can be anything
   AuthName "foobar"
   # For project "foobar"
   AuthUserFile /srv/trac/foobar/conf/trac.htpasswd
   Require valid-user

<IfModule mod_dav.c>
<Location /svn>
    # Uncomment this to enable the repository,
    DAV svn
    # Set this to the path to your repository
    SVNPath /srv/svn

The example above assumes you have a Trac project environment setup in /srv/trac/foobar/ directory, described in step 2 and an htpasswd file at /opt/trac/trac.htpasswd for authentication purposes. See also wiki:TracModPython.

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 Fedora Extras Trac package:

  • trac.cgi and trac.fcgi are installed in /var/www/cgi-bin/ (actually, /usr/share/trac/cgi-bin for FC5).
  • apache webserver config file is installed in /etc/httpd/conf.d/trac.conf

If you happen to come across any packaging issues, feature requests or problems on Fedora, you can submit a bugzilla bug for the Trac package at https://bugzilla.redhat.com/bugzilla/easy_enter_bug.cgi.

Be sure to check out the generic installation instructions in the TracGuide.

Create admin user

So that login will have a password file can refer to, as in this example for project foobar:

 htpasswd -c /srv/trac/foobar/conf/trac.htpasswd adminuser

and follow webadmin instruction to assign "adminuser" as the trac admin.


Fedora Core 5 ships with SELinux enabled by default. You need to make the Trac and Subversion directory accessible to the webserver. If you put these contents under /var/www/trac and /var/www/svn to follow RedHat's standard for location of web contents, you don't need to do anything extra for SELinux. But if you want an alternative location such as /srv, 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 the lines:

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

to the file /etc/selinux/targeted/contexts/files/filecontexts.local. You may need to create this file if it is not already present. If SELinux continues to block write access for Trac, you may have the httpd_unified policy turned off. In this case, try these lines instead:

 /srv/trac(/.*)?    system_u:object_r:httpd_sys_content_rw_t
 /srv/svn(/.*)?     system_u:object_r:httpd_sys_content_rw_t
Note: See TracWiki for help on using the wiki.