Trac

From KevinWiki

(Difference between revisions)
Jump to: navigation, search
Line 4: Line 4:
[http://trac.edgewall.org Trac] is an open-source [[wikipedia:Issue tracking system|Issue Tracking System]].
[http://trac.edgewall.org Trac] is an open-source [[wikipedia:Issue tracking system|Issue Tracking System]].
-
==Installation==
+
==Trac Installation==
<pre>
<pre>
$ sudo apt-get install trac libapache2-mod-python  
$ sudo apt-get install trac libapache2-mod-python  
</pre>
</pre>
-
==Setup==
+
==Installation of the Dependences==
-To set up and use trac,  
-To set up and use trac,  
#Trac project directory should be created.
#Trac project directory should be created.
#Trac project directory info should be added to apache2 sites-enabled,
#Trac project directory info should be added to apache2 sites-enabled,
#Database table for it should be created,  
#Database table for it should be created,  
-
#Trac project environment should be initialised.
 
===Create Project Directory===
===Create Project Directory===
Line 37: Line 36:
     PythonOption TracEnvParentDir /opt/trac
     PythonOption TracEnvParentDir /opt/trac
     PythonOption TracUriRoot /trac
     PythonOption TracUriRoot /trac
 +
#    PythonOption PYTHON_EGG_CACHE /tmp
 +
    SetEnv PYTHON_EGG_CACHE /tmp
   </Location>
   </Location>
Line 45: Line 46:
     Require valid-user
     Require valid-user
   </LocationMatch>
   </LocationMatch>
 +
-If <code>PythonOption PYTHON_EGG_CACHE /tmp</code> does not work and the following errors are displayed, use <code>SetEnv PYTHON_EGG_CACHE /tmp</code> instead.
 +
<pre>
 +
...
 +
 +
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: '/var/www/.python-eggs'
 +
 +
The Python egg cache directory is currently set to:
 +
 +
  /var/www/.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.
 +
</pre>
 +
-Enable it and reload apache2 config or restart it.
-Enable it and reload apache2 config or restart it.
Line 96: Line 117:
-
===Initialise Project Environment===
+
==Project Environment Initialisation==
-Now initialise project.
-Now initialise project.
  $ sudo trac-admin /opt/trac/'''project''' initenv
  $ sudo trac-admin /opt/trac/'''project''' initenv
Line 214: Line 235:
   
   
  Congratulations!
  Congratulations!
 +
 +
-Set the permission.
 +
$ sudo chown -R www-data:www-data /opt/trac
 +
 +
 +
 +
==Plugin Installation==
 +
There are numerous plug-ins available for Trac.
 +
 +
===WebAdmin===
 +
WebAdmin is web user interface to administrate trac.
 +
 +
====Installation====
 +
-Install the trac:WebAdmin plug-in.
 +
 +
#sudo svn export http://svn.edgewall.com/repos/trac/sandbox/webadmin/
 +
$ sudo easy_install http://svn.edgewall.com/repos/trac/sandbox/webadmin/
 +
 +
-add TRAC_ADMIN permission to the user 'admin' in the project.
 +
$ sudo trac-admin /opt/trac/project/ permission add admin TRAC_ADMIN
 +
 +
====Configuration====
 +
-add below to trac.ini
 +
(It is probably only for version 0.10. It has not been checked for 0.9)
 +
==========================
 +
[components]
 +
webadmin.* = enabled
 +
==========================
 +
 +
 +
 +
===AccountManagerPlugin===
 +
-To make managing trac account easy, install account manager plug-in.
 +
 +
====Install====
 +
-First make sure you've installed setuptools.
 +
$ sudo apt-get install python-setuptools
 +
 +
--------------------------------------------
 +
 +
Then you can install the plugin using the easy_install application.
 +
 +
Note: Windows users will need to add easy_install to their PATH.
 +
 +
For Trac 0.9:
 +
 +
$ sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/0.9
 +
 +
 +
-----------------------------------------------------------------------------
 +
For Trac 0.10:
 +
 +
Then install this plugin:
 +
 +
$ sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/0.10
 +
-----------------------------------------------------------------------------
 +
 +
 +
For Trac 0.11: (and check #899 patch)
 +
 +
$ sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/trunk
 +
 +
 +
====Configuration====
 +
#First, access Trac and log in with admin ID.
 +
#Go to Admin menu and configure Accounts module including set up the location of .htpasswd or .htdigest file.
 +
#Add the following lines to trac.ini file in the <code>trac_project/conf</code> directory
 +
 +
-Not necessary for 0.11
 +
<code>trac.ini</code>
 +
[components]
 +
acct_mgr.admin.accountmanageradminpage = enabled
 +
acct_mgr.api.accountmanager = enabled
 +
acct_mgr.db.sessionstore = enabled
 +
acct_mgr.htfile.abstractpasswordfilestore = enabled
 +
acct_mgr.htfile.htdigeststore = enabled
 +
acct_mgr.htfile.htpasswdstore = enabled
 +
acct_mgr.http.httpauthstore = enabled
 +
acct_mgr.pwhash.htdigesthashmethod = enabled
 +
acct_mgr.pwhash.htpasswdhashmethod = enabled
 +
acct_mgr.web_ui.accountmodule = enabled
 +
acct_mgr.web_ui.loginmodule = enabled
 +
acct_mgr.web_ui.registrationmodule = enabled
 +
trac.web.auth.loginmodule = disabled
 +
webadmin.* = enabled
 +
 +
-may only need this.
 +
'''add: trac.web.auth.loginmodule = disabled'''
 +
 +
 +
-Not necessary if you set it up through web admin
 +
[account-manager]
 +
htdigest_realm = tectra_trac
 +
password_file = /opt/trac/project/conf/users.htdigest
 +
password_store = HtDigestStore
 +
-or
 +
[account-manager]
 +
htdigest_realm = tectra_trac
 +
password_file = /opt/trac/project/conf/users.htpasswd
 +
password_store = HtPasswdStore
 +
 +
 +
-comment out the authentication info of trac in the available sites (/etc/apache2/sites-available/trac).
 +
#  <LocationMatch "/trac/[^/]+/login">
 +
#    AuthType Basic
 +
#    AuthName "Trac"
 +
#    AuthUserFile /etc/subversion/.passwd
 +
#    Require valid-user
 +
#  </LocationMatch>
 +
 +
-Restart Apache2
 +
$ sudo /etc/init.d/apache2 restart

Revision as of 04:21, 7 November 2008


Contents

Trac

Trac is an open-source Issue Tracking System.

Trac Installation

$ sudo apt-get install trac libapache2-mod-python 

Installation of the Dependences

-To set up and use trac,

  1. Trac project directory should be created.
  2. Trac project directory info should be added to apache2 sites-enabled,
  3. Database table for it should be created,

Create Project Directory

-To set up a trac project, create a directory for the project.

$ sudo mkdir /opt/trac 
$ sudo chown www-data:www-data /opt/trac 

-Create available site info for trac

$ cd /etc/apache2/sites-available 
$ sudo vim trac

Add Project Info to Apache

-Add the following lines

 <Location /trac>
   SetHandler mod_python
   PythonInterpreter main_interpreter
   PythonHandler trac.web.modpython_frontend
   PythonOption TracEnvParentDir /opt/trac
   PythonOption TracUriRoot /trac
  1. PythonOption PYTHON_EGG_CACHE /tmp
   SetEnv PYTHON_EGG_CACHE /tmp
 </Location>
 <LocationMatch "/trac/[^/]+/login">
   AuthType Basic
   AuthName "Trac"
   AuthUserFile /etc/subversion/.passwd
   Require valid-user
 </LocationMatch>

-If PythonOption PYTHON_EGG_CACHE /tmp does not work and the following errors are displayed, use SetEnv PYTHON_EGG_CACHE /tmp instead.

...

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: '/var/www/.python-eggs'

The Python egg cache directory is currently set to:

  /var/www/.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.


-Enable it and reload apache2 config or restart it.

$ sudo a2ensite trac
$ sudo /etc/init.d/apache2 reload
or
$ sudo /etc/init.d/apache2 restart


Create and Setup Database Table

-Create database table for trac.

CREATE DATABASE trac DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;


-Check if its character set is correct

mysql> USE trac;
Database changed
mysql> SHOW VARIABLES LIKE '%character%';
+--------------------------+--------------------
| Variable_name            | Value
+--------------------------+--------------------
| character_set_client     | cp1251
| character_set_connection | cp1251
| character_set_database   | utf8
| character_set_filesystem | binary
| character_set_results    | cp1251
| character_set_server     | utf8
| character_set_system     | utf8
| character_sets_dir       | C:\DevServer\Instal
+--------------------------+--------------------
8 rows in set (0.00 sec)


-Allocate the admin user of trac database table.

GRANT ALL ON trac.* TO 'trac'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;


-The connection string is

mysql://trac:password@localhost/trac


Project Environment Initialisation

-Now initialise project.

$ sudo trac-admin /opt/trac/project initenv
Creating a new Trac environment at /opt/trac/project                   

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://trac:password@localhost/trac

 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]> 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]> /opt/svn/myproject

Creating and Initializing Project
 Installing default wiki pages   
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracImport imported from TracImport
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracIni imported from TracIni      
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracNavigation imported from TracNavigation
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TitleIndex imported from TitleIndex        
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracTimeline imported from TracTimeline    
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracSearch imported from TracSearch        
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracWiki imported from TracWiki            
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracCgi imported from TracCgi              
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiRestructuredText imported from WikiRestructuredText
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracAdmin imported from TracAdmin                      
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracRoadmap imported from TracRoadmap                  
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiNewPage imported from WikiNewPage                  
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiFormatting imported from WikiFormatting            
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/RecentChanges imported from RecentChanges              
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracSupport imported from TracSupport                  
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracRevisionLog imported from TracRevisionLog          
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiDeletePage imported from WikiDeletePage            
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracLogging imported from TracLogging                  
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracTicketsCustomFields imported from TracTicketsCustomFields
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracFastCgi imported from TracFastCgi                        
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracStandalone imported from TracStandalone                  
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracBackup imported from TracBackup                          
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracAccessibility imported from TracAccessibility            
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracNotification imported from TracNotification              
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracModPython imported from TracModPython                    
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracWorkflow imported from TracWorkflow                      
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracChangeset imported from TracChangeset                    
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/CamelCase imported from CamelCase                            
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracGuide imported from TracGuide                            
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracBrowser imported from TracBrowser                        
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracEnvironment imported from TracEnvironment                
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracRss imported from TracRss                                
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/PageTemplates imported from PageTemplates                    
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/InterMapTxt imported from InterMapTxt                        
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiProcessors imported from WikiProcessors                  
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracQuery imported from TracQuery                            
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/InterWiki imported from InterWiki                            
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracPermissions imported from TracPermissions                
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/InterTrac imported from InterTrac                            
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracReports imported from TracReports                        
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracTickets imported from TracTickets                        
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiStart imported from WikiStart                            
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiRestructuredTextLinks imported from WikiRestructuredTextLinks
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracLinks imported from TracLinks                                
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiPageNames imported from WikiPageNames                        
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracInstall imported from TracInstall                            
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracUnicode imported from TracUnicode                            
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracInterfaceCustomization imported from TracInterfaceCustomization
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracPlugins imported from TracPlugins                              
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracUpgrade imported from TracUpgrade                              
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiMacros imported from WikiMacros                                
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracFineGrainedPermissions imported from TracFineGrainedPermissions
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiHtml imported from WikiHtml                                    
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/SandBox imported from SandBox                                      
 /usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracSyntaxColoring imported from TracSyntaxColoring                
 Indexing repository                                                                                                         

---------------------------------------------------------------------
Project environment for 'My Project' created.

You may now configure the environment by editing the file:

  /opt/trac/project/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 /opt/trac/project

Then point your browser to http://localhost:8000/project.
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!

-Set the permission.

$ sudo chown -R www-data:www-data /opt/trac 


Plugin Installation

There are numerous plug-ins available for Trac.

WebAdmin

WebAdmin is web user interface to administrate trac.

Installation

-Install the trac:WebAdmin plug-in.

#sudo svn export http://svn.edgewall.com/repos/trac/sandbox/webadmin/
$ sudo easy_install http://svn.edgewall.com/repos/trac/sandbox/webadmin/ 

-add TRAC_ADMIN permission to the user 'admin' in the project.

$ sudo trac-admin /opt/trac/project/ permission add admin TRAC_ADMIN 

Configuration

-add below to trac.ini (It is probably only for version 0.10. It has not been checked for 0.9)

==========================
[components]
webadmin.* = enabled
==========================


AccountManagerPlugin

-To make managing trac account easy, install account manager plug-in.

Install

-First make sure you've installed setuptools. $ sudo apt-get install python-setuptools


Then you can install the plugin using the easy_install application.

Note: Windows users will need to add easy_install to their PATH.

For Trac 0.9:

$ sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/0.9



For Trac 0.10:

Then install this plugin:

$ sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/0.10



For Trac 0.11: (and check #899 patch)

$ sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/trunk


Configuration

  1. First, access Trac and log in with admin ID.
  2. Go to Admin menu and configure Accounts module including set up the location of .htpasswd or .htdigest file.
  3. Add the following lines to trac.ini file in the trac_project/conf directory

-Not necessary for 0.11 trac.ini

[components]
acct_mgr.admin.accountmanageradminpage = enabled
acct_mgr.api.accountmanager = enabled
acct_mgr.db.sessionstore = enabled
acct_mgr.htfile.abstractpasswordfilestore = enabled
acct_mgr.htfile.htdigeststore = enabled
acct_mgr.htfile.htpasswdstore = enabled
acct_mgr.http.httpauthstore = enabled
acct_mgr.pwhash.htdigesthashmethod = enabled
acct_mgr.pwhash.htpasswdhashmethod = enabled
acct_mgr.web_ui.accountmodule = enabled
acct_mgr.web_ui.loginmodule = enabled
acct_mgr.web_ui.registrationmodule = enabled
trac.web.auth.loginmodule = disabled
webadmin.* = enabled
-may only need this.
add: trac.web.auth.loginmodule = disabled


-Not necessary if you set it up through web admin

[account-manager]
htdigest_realm = tectra_trac
password_file = /opt/trac/project/conf/users.htdigest
password_store = HtDigestStore

-or

[account-manager]
htdigest_realm = tectra_trac
password_file = /opt/trac/project/conf/users.htpasswd
password_store = HtPasswdStore


-comment out the authentication info of trac in the available sites (/etc/apache2/sites-available/trac).

#  <LocationMatch "/trac/[^/]+/login">
#    AuthType Basic
#    AuthName "Trac"
#    AuthUserFile /etc/subversion/.passwd
#    Require valid-user
#  </LocationMatch>

-Restart Apache2

$ sudo /etc/init.d/apache2 restart
Personal tools