Dave Perrett

Installing Trac on CentOS

database, linux, programming, python, version control, web

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

  2. Install the python easy install tool:

1
2
$ wget http://peak.telecommunity.com/dist/ez_setup.py
$ sudo python ez_setup.py
  1. Install Trac :
1
$ sudo easy_install Trac
  1. Install mod_python :
1
$ sudo yum install mod_python python-devel
  1. Create a new Trac project :
1
$ 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 :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
ExtractionError: Can't extract file(s) to egg cache

The following error occurred while trying to extract file(s) to the Python egg
cache:

[Errno 13] Permission denied: '/root/.python-eggs'

The Python egg cache directory is currently set to:

 /root/.python-eggs

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 ):

1
$ sudo easy_install -Z  Genshi==0.5
  1. Setup a password file for authentication :
1
$ sudo htpasswd /var/www/trac/my_project/conf/passwords my_new_user
  1. Install a couple of useful plugins (you can skip this step if you want a default trac installation) :
1
2
3
4
5
$ sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/trunk
$ sudo easy_install http://trac-hacks.org/svn/growlplugin/0.11/
$ sudo easy_install http://www.daveperrett.com/svn/ganttcalendar/trunk/
$ sudo easy_install http://trac-hacks.org/svn/datefieldplugin/0.11/
$ sudo easy_install http://trac-hacks.org/svn/breadcrumbsnavplugin/0.11

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
[components]
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

[account-manager]
password_file = /var/www/trac/my_project/conf/passwords
password_store = HtPasswdStore

[growl]
sources = wiki, ticket, attachment, bitten
hosts =
userprefs = true

[datefield]
format = ymd
separator = /

[ticket-custom]
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
due_assign.date = true
due_assign.date_empty = true
due_close = text
due_close.label = End (YYYY/MM/DD)
due_close.order = 2
due_close.date = 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).

  1. Make your new user an administrator :
1
$ trac-admin /var/www/trac/my_project permission add my_new_user TRAC_ADMIN
  1. Create a config file for Apache similar to the following :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
    </Directory>

    <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 /
    </Location>

</VirtualHost>
  1. Restart Apache:
1
$ sudo /etc/init.d/httpd restart

Setting up Growl notifications (Mac Users)

If you chose to install the Growl Plugin in step 7, you’ll need to do a little more configuration to get it working:

  1. Make your new user a GROWL_ADMIN:
1
$ sudo trac-admin /var/www/trac/my_project permission add my_new_user GROWL_ADMIN
  1. Go to your user preferences in Trac and set up Growl broadcasting :

  2. Go to System Preferences -> Growl on your Mac, and enable incoming connections : You don’t need to add a password (assuming you trust your local network :)

Once this is done, try adding a comment to a ticket, and you should get a Growl notification :