Trac
From KevinWiki
Line 288: | Line 288: | ||
===WebAdmin=== | ===WebAdmin=== | ||
WebAdmin is web user interface to administrate trac. | WebAdmin is web user interface to administrate trac. | ||
+ | * From 0.11 it is included in the core package so no need to install it. | ||
====Installation==== | ====Installation==== |
Revision as of 03:36, 11 March 2010
Contents |
Trac
Trac is an open-source Issue Tracking System.
Trac Installation
Install Trac 0.11 on Ubuntu Linux 8.10 Intrepid
From the Ubuntu Repository
$ sudo apt-get install trac libapache2-mod-python python-mysqldb
Through easy_install
It requires the following dependencies to be installed beforehand.
$ apt-get install python-pysqlite2 python-subversion python-support python-setuptools libapache2-mod-python python-mysqldb
- Install Trac through
easy_install
in thepython-setuptools
.
$ sudo easy_install Trac
Install Trac 0.11 on Ubuntu Linux 8.04 Hardy
- Install dependencies.
$ sudo apt-get install python-pysqlite2 python-subversion python-support python-setuptools libapache2-mod-python python-mysqldb
- Install it.
$ sudo easy_install Trac
- Not necessary if using
easy_install
- *Extract the trac 0.11 archive file downloaded from the trac web-site.
# $ tar -xzvf Trac-0.11.1.tar.gz
- *Install it.
# $ cd Trac-0.11.1 # $ sudo easy_install Trac
Preparation for Project Creation
-To set up and use trac,
- Trac project directory should be created.
- Trac project directory info should be added to apache2 sites-enabled.
- Database for the Trac 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 # PythonOption PYTHON_EGG_CACHE /tmp SetEnv PYTHON_EGG_CACHE /tmp SSLRequireSSL </Location> <LocationMatch "/trac/[^/]+/login"> AuthType Basic AuthName "Trac" AuthUserFile /etc/subversion/.passwd Require valid-user </LocationMatch>
-SSLRequireSSL is to use SSL for accessing the Trac project.
-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 the Database and Setup the User
-Create the database for the 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 the trac database.
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.
- From 0.11 it is included in the core package so no need to install it.
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
- create an htpasswd file or an htaccess file for the
admin
user.
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. -To see the details, visit the AccountManagerPlugin homepage.
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 (doesn't currently work with 0.11.4, see #4125) (also if necessary, check #899 patch):
$ sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/0.11
For Trac 0.12:
$ sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/trunk
Configuration
- Make sure virtual host setup for trac has the following info and, the .htpasswd file has a user the username of which is
admin
. The file must be located in the right place as specified below. Otherwise it will get an error message when logging in.
<LocationMatch "/[^/]+/login"> AuthType Basic AuthName "Trac" AuthUserFile /etc/subversion/.test_passwd Require valid-user </LocationMatch>
- Access Trac and log in with admin ID.
- Go to Admin menu and configure Accounts module (probably almost everything expect htpasswd ones and RegistrationModule).
- Go to
Accounts -> Configuration
- Set
HtDigestStore
(The file does not have to exist as Trac will create one yet it is better to use the existing htdigest file with the admin user info).
e.g.) 1 HtDigestStore filename: /opt/trac/project/conf/.filename.htdigest realm: realm_name
- The
/opt/trac/project/conf/.filename.htdigest
file can be shared with svn in both apache site setup andSvnServePasswordStore
.
e.g.) -- SvnServePasswordStore filename: /opt/trac/project/conf/.filename.htdigest
- 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
- If email verification is used, also make sure that smtp is enabled.
[notification] ...... smtp_enabled = true
- 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
- Optional: change
[trac] ... default_charset = iso-8859-15
to
[trac] ... default_charset = utf-8
- 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
Known Problem with Mylyn
Problem
Mylyn, an Eclipse plug-in, is currently not working with Trac 0.11. It does not recognise Trac 0.11 repository.
Solution
It can be solved by using XmlRpcPlugin.
-To install,
$ sudo easy_install http://trac-hacks.org/svn/xmlrpcplugin/trunk/
-Access the Trac and log in with the admin ID. Go to the Admin menu and enable all the components or the following ones in the TracXMLRPC plug-in.
XMLRPCSystem WikiRPC All the components with .ticket
- When accessing the Trac through Mylin, select
XML-RPC Pligin (Rev. 1950)
in the 'Additional Settings' as the access type.
Trac with SSL and Virtual Host
-Edit /etc/apache2/sites-available/trac
file with the following lines.
<VirtualHost *:443> ServerAdmin kevin@yoursite.com SSLEngine on SSLOptions +StrictRequire SSLCertificateFile /etc/ssl/certs/server.crt SSLCertificateKeyFile /etc/ssl/private/server.key # DocumentRoot /opt/trac ServerName trac.yoursite.com # <Location /trac> <Location /> SetHandler mod_python PythonInterpreter main_interpreter PythonHandler trac.web.modpython_frontend PythonOption TracEnvParentDir /opt/trac # PythonOption TracUriRoot /trac PythonOption TracUriRoot / # PythonOption PYTHON_EGG_CACHE /tmp SetEnv PYTHON_EGG_CACHE /tmp # SSLRequireSSL </Location> # <LocationMatch "/[^/]+/login"> # AuthType Basic # AuthName "Trac" # AuthUserFile /etc/subversion/.test_passwd # Require valid-user # </LocationMatch> </VirtualHost>
- To use htdigest instead of htpasswd
<LocationMatch "/[^/]+/login"> AuthType Digest AuthName realm AuthUserFile /somepath/.mclicker.htdigest Require valid-user </LocationMatch>
- Yet this might not be necessary. Better use an htpasswd for accessing trac then use web admin to set up an htdigest file for the user management.
- Restart Apache2
$ sudo /etc/init.d/apache2 restart
- If the authentication type is
Digest
and there is an error message like this
Invalid command 'AuthUserFile', perhaps misspelled or defined by a module not included in the server configuration ...fail!
- Enable auth_digest module.
$ a2enmod auth_digest
Now trac can be accessed through the URL https://trac.yoursite.com
so the project URL in the Trac will be like below.
https://trac.yoursite.com/myproject