Trac
From KevinWiki
Contents |
Trac
Trac is an open-source Issue Tracking System.
Installation
$ sudo apt-get install trac libapache2-mod-python
Setup
-To set up and use trac,
- Trac project directory should be created.
- Trac project directory info should be added to apache2 sites-enabled,
- Database table for it should be created,
- Trac project environment should be initialised.
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 </Location>
<LocationMatch "/trac/[^/]+/login"> AuthType Basic AuthName "Trac" AuthUserFile /etc/subversion/.passwd Require valid-user </LocationMatch>
-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
Initialise Project Environment
-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!