Loading...

Knowledge Base
Categories:

Install Trac

Did you find this article helpful?
Copy Link

 
* Your feedback is too short
Share

This guide will explain how to install Trac on your account, and assumes you have knowledge of MySQL and Trac. Installing Trac is not for the faint-hearted. It is not easy to install and to administer. If you are up for the challenge, by all means carry on! If this seems a bit too complex for you, give some other bug/project management software a go.
Note: you will be using SSH (shell) and raw Linux commands for this guide.

This guide uses the following software versions:

  • Trac 0.10

  • ClearSilver (Python) 10.3 binary

  • Python 2.4

We will be running Trac on FastCgi and using the experimental MySQL database support for Trac. This guide does not install SVN bindings for Trac.

Get Everything Ready

Let's go ahead and get our files together and organize them. To get started:

  1. Log in to your account via SSH, ensuring that you are in the HOME directory

    wget http://ftp.edgewall.com/pub/trac/trac-0.10.tar.gz
    tar zxf trac-0.10.tar.gz
    cd trac-0.10
    python ./setup install --prefix=$HOME/trac

     

    That will get Trac and install it into your HOME directory under the folder called "trac".

  2. Install ClearSilver

    You will only need one file called 'neo_cgi.so'. As ClearSilver website does not provide downloads for binaries, you will have to search on the web for that file. Please refer to the forum post listed at the start of this guide for help in finding the file. Please note that you will have to search for 'Python ClearSilver binary' which is the file 'neo_cgi.so'.

  3. Once you find the correct 'neo_cgi.so', run the following command:

    cp neo_cgi.so $HOME/trac/lib/python-2.4/site-packages/

     

Note: if the server you are in is a 64-bit OS you'll have to find a 64-bit binary version. To find out the OS you are running, log into your website's cPanel and look for General Server Information. You should see a field labeled Machine Type, which will list whether it is a 64-bit or 32-bit OS.

32-bit

  • i386

  • i686

  • x86_32

64-bit

  • x86_32

Set Up the Database

Trac will use one database per project. So if you have more than one project, please create the necessary amount of databases needed.

  1. Log into your cPanel and click MySQL Databases

  2. Scroll down to the New Database input box and enter a name for your new database

  3. Click Create Database

    If all goes well, you should see a page telling you that 'ASOusername_databasename' was created. Of course, ASOusername is your ASO Username, and databasename is the name you entered in the input box. Before Trac can access the database, it needs a user.

  4. Return to the MySQL Databases pageIf you already have a global user created (mine is called main) you can just scroll down to Add Users To Your Databases

    Note: if you don't have a user created yet, scroll down to Current Users, enter a username and a password, then click Create User. Then follow the steps for adding a user to the database.

  5. Choose your user and then the new database you just created and click Add User to Database 

Initialize Trac Environment

  1. Create our project directory:

    cd $HOME/trac
    mkdir myproject

    That will bring us to our trac installation directory and create a folder call 'myproject'.

  2. Set up the appropriate paths:

    export PATH=$HOME/trac/bin/:$PATH
    export PYTHONPATH=$HOME/trac/lib/python2.4/site-packages

     

  3. The command provides us the necessary path to run 'trac-admin'

  4. We are ready to initialise our project environment; run the following command:

    trac-admin $HOME/trac/myproject initenv

     

Follow the output below and correct where necessary in your case.

 Creating a new Trac environment at /home/{user}/trac/myproject

 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]> My 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]> mysql://user:password@localhost/database_name

 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]> 

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

 Templates directory [/home/{user}/trac/share/trac/templates]> 

 Creating and Initializing Project
...

 ---------------------------------------------------------------------
Project environment for 'New Project' created.

 You may now configure the environment by editing the file:

   /home/{user}/trac/myproject/conf/trac.ini

 ...

 Congratulations!

Run Trac

Make sure you are in your 'public_html' directory and execute the following:

mkdir trac
cd trac

 

We will create a directory where trac will run from. Then make sure we are in that folder.

Now create a file call 'index.fcgi' in that folder ($HOME/public_html/trac) and enter the following lines:

#!/bin/bash
export PATH=/home/{user}/trac/bin:$PATH
export PYTHONPATH=/home/{user}/trac/lib/python2.4/site-packages
export TRAC_ENV=/home/{user}/trac/myproject
exec /home/{user}/trac/share/trac/cgi-bin/trac.fcgi

 

Please change {user} where necessary. Now create an '.htaccess' file in the folder ($HOME/public_html/trac) with the following contents:

DirectoryIndex index.fcgi 

Resources

ClearSilver 32-bit Binary

Troubleshooting

To check if Trac is installed properly. Navigate to '$HOME/public_html/trac' and run the following command:

exec ./index.fcgi

This will execute the file in SSH. If the output spits out HTML tags, it means you have successfully installed Trac. If the last few lines contains 'TracError: ClearSilver not installed (/lib/tls/libc.so.6: version `GLIBC_2.4' not found' or something with 'ClearSilver', it means that you have the wrong version of ClearSilver.

500 Error

Check that the following files are chmod 755:

  • $HOME/trac/share/trac/cgi-bin/trac.fcgi

  • $HOME/public_html/trac/index.fcgi

     

Check that the "index.fcgi" has proper Unix newline.

 

Did you find this article helpful?
Copy Link

 
* Your feedback is too short

Loading...