Installing Trac

From A2Wiki

Jump to: navigation, search

Please note that you must have shell access in order to install and use Trac. Shell access is included with all accounts small business and above. If you do not have shell, you can either upgrade to a Small Business level plan, or purchase it ala carte for $3 per month.

This example works for the version specified below. It may work with other versions and if it requires a different installation procedures for newer versions, we would appreciate you updating the documentation to reflect that. Thanks!

NOTE: This directions currently do not work with add-on domains or subdomains. There is something different in the Apache config for those; this should work for a single domain however

Contents

Change your shell

Before starting this process, file a ticket with support asking to get your shell changed to /bin/bash. The default jailshell will not let you successfully run Trac.

Once you have confirmation that your shell has been changed, you can continue with the Trac install process.

Note: on some of the newer servers, Python 2.3 is not installed, but 2.4 is. I successfully followed these directions, substituting "2.4" anyplace it says "2.3" for the Python version. Also, I did install this in a subdomain without any problems. --Brucet 22:15, 11 April 2008 (EDT)

Set up Python Environment

edit ~/.bashrc
alias python='/usr/bin/python2.4'
export PYTHONPATH=$HOME/lib/python2.4/site-packages

Exit, saving changes, and then do

source ~/.bashrc

to load the new settings.

Get the Trac sources

cd ~
ftp
open ftp.edgewall.com
cd /pub/trac
get trac-0.10.4.tar.gz
quit
tar zxf trac-0.10.4.tar.gz

Install Trac

This will install Trac in your home directory:

cd ~/trac-0.10.4
/usr/bin/python2.3 setup.py install --prefix=$HOME

A bunch of lines will flash by. When it's done, you will see:

Thank you for choosing Trac 0.10.4. Enjoy your stay!

Create a Subversion Project

Now we need to create an svn project for Trac to use:

cd ~
svnadmin create svn_project_name

Initialize a Trac Project

(Note: The Trac project name and the svnproject name need to the different. Otherwise the initenv below will NOT work!)

trac-admin ~/trac_project_name initenv

As part of the initenv command, you will need to enter the Trac project name, database connection string, path to repository, and templates directory. The next block shows an actual install. User input is after the [___]> prompts (no text means just press Enter):

# trac-admin ~/trac_project_name initenv
Creating a new Trac environment at /home/your_username/trac_project_name

Trac will first ask a few questions about your environment
in order to initalize and prepare the project database.

 Please enter the name of your project.
 This name will be used in page titles and descriptions.

Project Name [My Project]> Trac Project

 Please specify the connection string for the database to use.
 By default, a local SQLite database is created in the environment
 directory. It is also possible to use an already existing
 PostgreSQL database (check the Trac documentation for the exact
 connection string syntax).

Database connection string [sqlite:db/trac.db]>

 Please specify the type of version control system,
 By default, it will be svn.

 If you don't want to use Trac with version control integration,
 choose the default here and don't specify a repository directory.
 in the next question.

Repository type [svn]>

 Please specify the absolute path to the version control
 repository, or leave it blank to use Trac without a repository.
 You can also set the repository location later.

Path to repository [/path/to/repos]> /home/your_username/svn_project_name

 Please enter location of Trac page templates.
 Default is the location of the site-wide templates installed with Trac.

Templates directory [/home/your_username/share/trac/templates]>

Creating and Initializing Project
 Installing default wiki pages

 ... lots of lines snipped here ...

 Indexing repository

---------------------------------------------------------------------
Project environment for 'Trac Project' created.

You may now configure the environment by editing the file:

  /home/your_username/tracproject/conf/trac.ini

Now decide where you want trac under your webspace. I recommend "trac" as in:

/home/your_username/www/trac
  • You can create this by executing the following:
mkdir -p ~/www/trac
  • Change into this directory:
cd ~/www/trac
  • Create an .htaccess and add the following:
Options +ExecCGI

This will enable CGI scripts to work in this directory.

  • Issue the following command:
cp ~/share/trac/cgi-bin/trac.cgi . 

Fix trac.cgi Paths

Edit this copy of trac.cgi and set the Python environment properly. First, ensure the "shebang" line at the top points to the correct Python version:

#!/usr/bin/python2.3

Then insert the following lines after the first try: line:

    import os
    os.environ['TRAC_ENV'] = "/home/your_username/trac_project_name/"
    import sys
    sys.path.insert(0, '/home/your_username/lib/python2.3/site-packages')

Test Trac via Web Browser

In a browser window, the following URL should work now:

http://your_domain.com/trac/trac.cgi


Syntax highlighting with GNU enscript

You will have to build and enscript from source and put the compiled part into /home/username The compilation part is pretty confusing. You will have to define a prefix just like on your server:

./configure --prefix=/home/your_username

Then edit trac.cgi and add the following line:

os.environ['PATH'] += ":/home/your_username/bin"

To get ruby highlighting support, download ruby-enscript.tar.gz from http://neugierig.org/software/ruby/ and install it with respective instructions. If you still have any problems, email me at selecter @nofreakingspam@ gmail.com The support doesn't support Trac installation process. Sorry for tautology :)


Troubleshooting

  • 'If you catch an error related to neo_cgi module Submit a ticket and let them fix that. I contacted support and they fixed the ClearSilver problem. Their response was "The build/install process misplaced neo_cgi.so on your server. You should be all set. Thanks!"

HappyCoder: It actually happened at least twice. Because I also had to contact support to let them fix the problem.

  • No module named svn If you receive errors like "Failed to initialize environment. No module named svn", you need to contact support and have them verify there is a libsvn and svn directory underneath Python's site-packages directory on the server.
Personal tools