Home » Ubuntu Linux » Installing and Using Trac on Ubuntu 12.04

Installing and Using Trac on Ubuntu 12.04

install python setup tools before everything started, well, assuming you are not remove your python

sudo apt-get install python-setuptools

install trac using easy_install

sudo easy_install trac

create and initialize trac project

sudo trac-admin /path/to/trac_project initenv

install apache python mode

sudo apt-get install libapache2-mod-python

enable python mod in apache2

sudo a2enmod python

create your trac administrator account, type in password when prompt

sudo htpasswd -c /path/to/trac_project.htpasswd admin
sudo trac-admin /path/to/trac_project permission add admin TRAC_ADMIN

you need to give the apache2 permission to trac directory

sudo chown -R www-data: /path/to/trac_project 

add virtual host in apache2

sudo vi /etc/apache2/sites-available/trac_hosts

using the following example,

<VirtualHost *:80>
        ServerName tracproject.example.com
        <Location />
           SetHandler mod_python
           PythonInterpreter main_interpreter
           PythonHandler trac.web.modpython_frontend
           PythonOption TracEnv /path/to/trac_project
           PythonOption TracEnvParentDir /path/to/trac_project
           PythonOption TracUriRoot /
           PythonOption TracEnv /path/to/trac_project
            # PythonOption TracEnvIndexTemplate /path/to/trac_project/templates/index-template.html
           PythonOption TracLocale en_US.UTF8
           PythonOption PYTHON_EGG_CACHE /tmp
           Order allow,deny
           Allow from all
        <Location /login>
          AuthType Basic
          AuthName "myproject"
          AuthUserFile /path/to/trac_project/.htpasswd
          Require valid-user

enable trac virtual host, and restart server

sudo a2ensite trac_hosts
sudo /etc/init.d/apache2 restart

Leave a Reply

Your email address will not be published. Required fields are marked *