Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 01:34, 17 May 2008.

Trac installation guide

From Forum Nokia Wiki

If you have a web server with svn installed (see Subversion (SVN) server installation guide) you might like to explore the different functionalities of Trac.

Trac is a great web interface running on the top of a subversion which considerably helps the project management, bug tracking...

Here are some of the features
  • Internal wiki
  • iCalendar, for synchronization
  • Timeline, revision historic
  • Source browser with syntax coloration
  • RSS feeds
  • Possibility to add ticket, bug reporting and tracing
  • Internal search engine
  • Revision comparisons
  • File attachment
  • Integrated help
  • ....


With this article, we complete the server we started to configure in Subversion (SVN) server installation guide


Contents

Installation

Subversion
apt-get install trac
Create the following directory
/home/trac

Now all the subversion repositories will be in /home/svn and all trac projects in /home/trac


First trac project

Let say that we still have the test (/home/svn/test) repository from the previous article.

Any manipulations on Trac projects is made with the trac-admin command

trac-admin -h


Project creation
trac-admin /home/trac/test initenv
Creating a new Trac environment at /home/trac/test
 
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]> test
 
 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/svn/test
 
 Please enter location of Trac page templates.
 Default is the location of the site-wide templates installed with Trac.
 
Templates directory [/usr/share/trac/templates]>
 
Creating and Initializing Project
 Installing default wiki pages
 /usr/share/trac/wiki-default/TracModPython => TracModPython
 /usr/share/trac/wiki-default/TracRss => TracRss
 /usr/share/trac/wiki-default/WikiRestructuredText => WikiRestructuredText
 /usr/share/trac/wiki-default/TracStandalone => TracStandalone  /usr/share/trac/wiki-default/TracReports => TracReports
 /usr/share/trac/wiki-default/TracPlugins => TracPlugins
 /usr/share/trac/wiki-default/InterWiki => InterWiki
 /usr/share/trac/wiki-default/TracTimeline => TracTimeline
 /usr/share/trac/wiki-default/TracLinks => TracLinks
 /usr/share/trac/wiki-default/WikiNewPage => WikiNewPage
 /usr/share/trac/wiki-default/TracFastCgi => TracFastCgi
 /usr/share/trac/wiki-default/TracSearch => TracSearch
 /usr/share/trac/wiki-default/TracBackup => TracBackup
 /usr/share/trac/wiki-default/TracGuide => TracGuide
 /usr/share/trac/wiki-default/TracSupport => TracSupport
 /usr/share/trac/wiki-default/TracPermissions => TracPermissions
 /usr/share/trac/wiki-default/WikiDeletePage => WikiDeletePage
 /usr/share/trac/wiki-default/TracTickets => TracTickets
 /usr/share/trac/wiki-default/TracCgi => TracCgi
 /usr/share/trac/wiki-default/TracWiki => TracWiki
 /usr/share/trac/wiki-default/TracInterfaceCustomization => TracInterfaceCustomization
 /usr/share/trac/wiki-default/TracImport => TracImport
 /usr/share/trac/wiki-default/InterMapTxt => InterMapTxt
 /usr/share/trac/wiki-default/TracEnvironment => TracEnvironment
 /usr/share/trac/wiki-default/TracInstall => TracInstall
 /usr/share/trac/wiki-default/WikiProcessors => WikiProcessors
 /usr/share/trac/wiki-default/TracAccessibility => TracAccessibility
 /usr/share/trac/wiki-default/RecentChanges => RecentChanges
 /usr/share/trac/wiki-default/TracChangeset => TracChangeset
 /usr/share/trac/wiki-default/WikiHtml => WikiHtml
 /usr/share/trac/wiki-default/TracLogging => TracLogging
 /usr/share/trac/wiki-default/WikiPageNames => WikiPageNames
 /usr/share/trac/wiki-default/TracRoadmap => TracRoadmap
 /usr/share/trac/wiki-default/TitleIndex => TitleIndex
 /usr/share/trac/wiki-default/WikiStart => WikiStart
 /usr/share/trac/wiki-default/TracQuery => TracQuery  /usr/share/trac/wiki-default/WikiMacros => WikiMacros
 /usr/share/trac/wiki-default/TracIni => TracIni
 /usr/share/trac/wiki-default/WikiRestructuredTextLinks => WikiRestructuredTextLinks
 /usr/share/trac/wiki-default/TracTicketsCustomFields => TracTicketsCustomFields
 /usr/share/trac/wiki-default/WikiFormatting => WikiFormatting
 /usr/share/trac/wiki-default/TracAdmin => TracAdmin
 /usr/share/trac/wiki-default/TracNotification => TracNotification
 /usr/share/trac/wiki-default/TracSyntaxColoring => TracSyntaxColoring
 /usr/share/trac/wiki-default/TracUpgrade => TracUpgrade
 /usr/share/trac/wiki-default/SandBox => SandBox
 /usr/share/trac/wiki-default/InterTrac => InterTrac
 /usr/share/trac/wiki-default/TracBrowser => TracBrowser
 /usr/share/trac/wiki-default/CamelCase => CamelCase
 /usr/share/trac/wiki-default/TracUnicode => TracUnicode
 /usr/share/trac/wiki-default/TracRevisionLog => TracRevisionLog 
Warning:
 
You should install the SVN bindings
 
---------------------------------------------------------------------
Project environment for 'test' created.
 
You may now configure the environment by editing the file:
 
  /home/trac/test/conf/trac.ini
 
If you'd like to take this new project environment for a test drive,
try running the Trac standalone web server `tracd`:
 
  tracd --port 8000 /home/trac/test
 
Then point your browser to http://localhost:8000/test.
There you can also browse the documentation for your installed
version of Trac, including information on further setup (such as
deploying Trac to a real web server).
 
The latest documentation can also always be found on the project
website:
 
  http://trac.edgewall.org/
 
Congratulations!


Quick test
  • Commit some files in the repository
  • tracd --port 8000 /home/trac/test
  • Then point your browser to http://localhost:8000/test as described


Configuration

tracd

As shown above, tracd is a standalone server shipped with Trac.


Usage

tracd --help


It takes only few seconds to set up

tracd --port 8000 --hostname http://myserver.ltd --basic-auth /home/svn/test/myserverltd.htpasswd /home/trac/test

For basic-auth you give the path of your .htpasswd


Limitations

  • As svnserve, you can only run one instance of tracd at the time. It is not good enough if you have a server where you wish to host several project.
  • As svnserve, you will need to start tracd by hand and remember all parameters...


CGI and FastCGI

It is possible to use track by making a script alias on trac.cgi or trac.fcgi as described in the wiki


Prerequisite

Make sure to have CGI and FastCGI installed and configured for your apache distribution.


Configuration

Citation from TracFastCgi:

Configure ScriptAlias or similar options as described in TracCgi, but calling
trac.fcgi instead of trac.cgi.

One little unclear point is that trac.cgi and trac.fcgi are shipped with the Trac installation

%updatedb <-- this might take a while (needs to be done to use locate)
%locate trac.cgi
/usr/share/trac/cgi-bin/trac.cgi
%locate trac.fcgi
/usr/share/trac/cgi-bin/trac.fcgi


test.cgi or test.fcgi configuration for our test repository
cp /usr/share/trac/cgi-bin/trac.fcgi /var/myserver.ltd/ftp/cgi-bin/test.fcgi
nano /var/myserver.ltd/ftp/cgi-bin/test.fcgi

To add one repository to the Trac project, add at the top of the file

import os
os.environ['TRAC_ENV'] = "/home/trac/myMRC"

To add multiple repository to the Trac project add, at the top of the file

import os
os.environ['TRAC_ENV_PARENT_DIR'] = "/home/trac/myMRC"


Here is a virtual host example
###myserver.ltd###
<VirtualHost xxx.xxx.xxx.xxx>
        DocumentRoot /var/myserver.ltd/ftp/www
        ServerName myserver.ltd
        ServerAlias *.myserver.ltd
        CustomLog /var/log/apache/access.myserver.ltd.log combined
        ErrorLog /var/log/apache/error.myserver.ltd.log
 
        # php
        php_admin_value session.save_path /var/myserver.ltd/sessions
        php_admin_value upload_tmp_dir /var/myserver.ltd/tmp
        php_admin_flag safe_mode on
        
        ScriptAlias /cgi-bin/ /var/myserver.ltd/ftp/cgi-bin/
        VirtualDocumentRoot /home/myserver.ltd/ftp/%1
        
        # Alias for trac
        ScriptAlias /trac /home/myserver.ltd/ftp/cgi-bin/trac.fcgi
        ScriptAlias /trac/ /home/myserver.ltd/ftp/cgi-bin/trac.fcgi
 
        # Trac authentication  
        <Location "/trac/login">
               AuthType Basic
               AuthName "Trac"
               AuthUserFile /home/trac/test/conf/test.htpasswd
               Require valid-user
        </Location>
</VirtualHost>
###<myserver.ltd>###

With this example you access Trac via http://www.myserver.ltd/trac.

/trac/login path needs a valid authentication file. For this example it is put in /home/trac/test/conf/test.htpasswd

htpasswd -c /home/trac/test/conf/test.htpasswd myuser
htpasswd /home/trac/test/conf/test.htpasswd myuser2
...


I haven't been able to make a script alias on the root folder

ScriptAlias / /home/myserver.ltd/ftp/cgi-bin/trac.fcgi

It gives some location complications.


To fix this I added a redirection for the root folder (/) to /trac.

  • Create
nano /var/myserver.ltd/ftp/www/.htaccess
  • Add
Redirect Permanent / http://mymrc.org/trac/


Remember to restart apache
/etc/init.d/apache restart

or

/etc/init.d/apache2 restart


Mod Python

I have been able to set up the Trac environments only on Apache 2.2. There are some difficulties again with Apache 1.3.


Prerequisite

Make sure to install and enable mod_python

apt-get install libapache2-mod-python2.x


Configuration

Here is a virtual host example
###myserver.ltd###
<VirtualHost *>
    ServerAdmin admin@myserver.ltd
    ServerName  myserver.ltd
 
    <Location />
        SetHandler mod_python
        PythonHandler trac.web.modpython_frontend
        PythonOption TracEnv /home/trac/test
        PythonOption TracUriRoot /
    </Location>
 
    <Location /login>
        AuthType Basic
        AuthName "Test - Trac Server"
        AuthUserFile /home/trac/test/conf/test.htpasswd
        Require valid-user
    </Location>
 
    # Logs:
    LogLevel warn
    ErrorLog /var/log/apache2/error.myserver.ltd.log
    CustomLog /var/log/apache2/access.myserver.ltd.log combined
    ServerSignature On
</VirtualHost>
###<myserver.ltd>###


Remember to restart apache
/etc/init.d/apache2 restart


Configure trac.ini

Edit

/home/trac/myMRC/conf/trac.ini

There's not much configuration to make, just make sure to set 'link' in header and 'base_url' in trac. You can customize the rest later.

[header_logo]
alt =
height = -1
link = http://myserver.ltd/trac/
src = common/trac_banner.png
width = -1
 
[trac]
authz_file =
authz_module_name =
base_url = http://myserver.ltd/trac/
check_auth_ip = true
database = sqlite:db/trac.db
default_charset = iso-8859-15
default_handler = WikiModule
htdocs_location =
ignore_auth_case = false
mainnav = wiki,timeline,roadmap,browser,tickets,newticket,search
metanav = login,logout,settings,help,about
permission_store = DefaultPermissionStore
repository_dir = /home/svn/test
repository_type = svn
# request_filters = <set in global trac.ini>
# templates_dir = <set in global trac.ini>
timeout = 20


Brief trac-admin overview

Backups

trac-admin /home/trac/test/hotcopy /home/backup/trac

Milestones

You can start by cleaning adding, modifying... the milestones.

milestone list
trac-admin /home/trac/test/ milestone remove milestone4
trac-admin /home/trac/test/ milestone remove milestone3
trac-admin /home/trac/test/ milestone remove milestone2
trac-admin /home/trac/test/ milestone rename milestone1 "First beta version"
trac-admin /home/trac/test/ milestone due "First beta version" "2007-07-02"
trac-admin /home/trac/test/ milestone add "Estimated alpha release" "2007-12-31"

resync

You need to resync if you, for example, change the subversion repository

trac-admin /home/trac/test/ resync

...


Conclusion

Please complete the document if anything is missing.

Trac is a good project management environment that deserve some attention. The documentation is very well done and you should find everything you need in the help (Wiki syntax...).

I hope this will help some of you for your projects.

Related Discussions
Thread Thread Starter Forum Replies Last Post
Text display problem pjsip symbian_ua in E65 aftad Symbian Media (Graphics & Sounds) 1 2008-06-01 15:42
HTTPS in a thread bestey Symbian Networking & Messaging 5 2007-08-29 09:11
After installation, I can't find the application in my Nokia 3650 winghui430 Symbian Tools & SDKs 3 2006-03-22 18:05
如何在symbian下开发数据库。 willing007 Symbian 3 2006-02-22 07:29
制作背景图标?? ipis Symbian 14 2005-11-11 03:45
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX