Installing Trac on CentOS

Posted by Jerzy Seweryn on
Installing Trac on CentOS

1. Before you do anything, go ahead and install subversion

2. Install the python easy install tool:

$ wget
$ sudo python

3. Install Trac :

$ sudo easy_install Trac

4. Install mod_python :

$ sudo yum install mod_python python-devel

5. Create a new Trac project :

$ sudo trac-admin /var/www/trac/my_project initenv MyProjectName sqlite:db/trac.db svn /var/lib/subversion/repositories/my_project/

Obviously adjust the paths, project name etc according to your setup.

if you get this error :

ExtractionError: Can't extract file(s) to egg cache
The following error occurred while trying to extract file(s) to the Python egg
[Errno 13] Permission denied: '/root/.python-eggs'
The Python egg cache directory is currently set to:
Perhaps your account does not have write access to this directory?  You can
change the cache directory by setting the PYTHON_EGG_CACHE environment
variable to point to an accessible directory.

Then running this seems to fix it (courtesy of the trac-users mailing list ):

$ sudo easy_install -Z  Genshi==0.5

6. Setup a password file for authentication :

$ sudo htpasswd /var/www/trac/my_project/conf/passwords my_new_user

7. Install a couple of useful plugins (you can skip this step if you want a default trac installation) :

$ sudo easy_install
$ sudo easy_install
$ sudo easy_install
$ sudo easy_install
$ sudo easy_install

Add the following entries to your /var/www/trac/my_project/conf/trac.ini file to setup the various plugins :

acct_mgr.* = enabled
acct_mgr.admin.accountmanageradminpage = enabled
acct_mgr.web_ui.accountmodule = enabled
acct_mgr.web_ui.loginmodule = enabled
acct_mgr.web_ui.registrationmodule = disabled
datefield.filter.datefieldmodule = enabled
ganttcalendar.ticketcalendar.ticketcalendarplugin = enabled
ganttcalendar.ticketgantt.ticketganttchartplugin = enabled
growl.notifier.* = enabled
growl.web_ui.growlpreferencepanel = enabled
trac.web.auth.loginmodule = disabled
password_file = /var/www/trac/my_project/conf/passwords
password_store = HtPasswdStore
sources = wiki, ticket, attachment, bitten
hosts =
userprefs = true
format = ymd
separator = /
complete = select
complete.label = % Complete
complete.options = 0|5|10|15|20|25|30|35|40|45|50|55|60|65|70|75|80|85|90|95|100
complete.order = 3
due_assign = text
due_assign.label = Start (YYYY/MM/DD)
due_assign.order = 1 = true
due_assign.date_empty = true
due_close = text
due_close.label = End (YYYY/MM/DD)
due_close.order = 2 = true
due_close.date_empty = true

Also, make sure ‘default_charset=UTF-8’ is present under the [trac] section (add it if it’s not).

8. Make your new user an administrator :

$ trac-admin /var/www/trac/my_project permission add my_new_user TRAC_ADMIN

9. Create a config file for Apache similar to the following :

NameVirtualHost *:9091
<VirtualHost *:9091>
    DocumentRoot /var/www/trac/my_project
    ServerName my_server_name
    ErrorLog logs/trac_error_log
    CustomLog logs/trac_access_log common
    <Directory "/var/www/trac/my_project">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    <Location />
        SetEnv PYTHON_EGG_CACHE /usr/share/trac/plugin-cache
        SetHandler mod_python
        PythonInterpreter main_interpreter
        PythonHandler trac.web.modpython_frontend
        PythonOption TracEnv /var/www/trac/my_project
        PythonOption TracUriRoot /

10. Restart Apache:

$ sudo /etc/init.d/httpd restart