| Subversion server installation and Configuration: |
Red Hat server / Fedora server example:
Install from RPM (RHEL4): rpm -ivh subversion-1.1.4-2.ent.i386.rpm
(RHEL4 default)
or download newer releases for RHEL4 from Tigris.org
Upgrade: rpm -Uvh subversion-tools-1.4.2-1.i386.rpm
subversion-python-1.4.2-1.i386.rpm subversion-perl-1.4.2-1.i386.rpm
subversion-1.4.2-1.i386.rpm mod_dav_svn-1.4.2-1.i386.rpm
apr-0.9.12-1.i386.rpm apr-devel-0.9.12-1.i386.rpm
apr-util-0.9.12-1.i386.rpm
Ubuntu: apt-get install subversion enscript libapache2-mod-python python-docutils db4.3-util libapache2-svn subversion-tools
There are two database options available for the Subversion repository creation.
Discussion of differences and merits of FSFS vs Berkeley DB.
Create a Subversion repository using the FSFS database format: (as root)
- mkdir /srv/svn/repos
- svnadmin create --fs-type fsfs /srv/svn/repos
- chown apache:apache -R /srv/svn/repos
(The Apache web server running as user "apache" is the process owner
which will be interfacing with the Subversion repository.)
- SELinux security attribute assignment: (Red Hat EL4+, Fedora 3+)
restorecon -R /srv/svn/repos
or
chcon -R -h -t httpd_sys_content_t /srv/svn/repos"
Options:
- -h: affect symbolic links instead of any referenced file
- -t: set type TYPE in the target security context
- -R: change files and directories recursively
(Required for SELinux systems so that apache can write to this area or turn off SELinux. For more info see the YoLinux SysAdmin/SELinux tutorial)
This will create the default database files, configuration files and directory structure required to support Subversion.
The choice of repository type is stored in /srv/svn/repository-name/db/fstype. In this case if you "cat" the file it will show "fsfs".
| Apache Web Server Configuration for Subversion: |
Subversion can be configured to use a local file system (NOT a
network filesystem!!!), it's own server (svnserve) or use Apache and
the webdav interface. This configuration shows the Subversion
installation configured with Apache on Red Hat Enterprise 4 (RHEL4).
Apache configuration file: /etc/httpd/conf.d/subversion.conf
See Subversion manual: authentication options for more information.
YoLinux.com Apache authentication tutorial - password file, NIS, LDAP, ...
Allow the web server to control conent: chown -R apache:apache /srv/svn
Restart Apache: service httpd restart
| Importing Directory of Files Into Subversion: |
Subversion Repository on Server File system:
Import directory of files into Subversion:
- Local directory to import into Subversion:
- projectX/trunk/...source code goes here...
- projectX/branches
- projectX/tags
- svn import -m "Initial Import" local-directory-projectX http://server-name/svn/projectX
The import will create the new subdirectory branch "projectX" in the repository.
Browser view of a typical repository directory schema:
- http://svn-server/svn/projectX/trunk: For the "HEAD"
- http://svn-server/svn/projectX/branches: For branches or "forks" in the code.
- http://svn-server/svn/projectX/tags: For tags identifying snapshots of milestones or significant releases.
Avoiding false diffs due to "^M" in a cross platform environment:
The Microsoft development tools love to add a "^M" at the end of the
line of every file they edit. This breaks UNIX shell script and causes
many file difference tools to show a differnece in a line of code. This
can be avoided in a cross platform environment by telling Subversion
that certain files (or all files) that no "^M"'s should be appended at
the end of a line. The trigger in fact removes the "^M" when the file
is checked in. It can also be removed using the command dos2unix.
Import files to support no "^M" carraige returns at the end of lines:
(This sets file properties and creates a check-in trigger.)
- Remove "^M" from files: find local-directory -name "*.cpp" -exec dos2unix {} \;
- Upload directory of files into Subversion:
svn import -m "Initial Import" local-directory http://server-name/svn/projectX
- Checkout files from repository: svn co http://server-name/svn/projectX/trunk
This creates your local working directory under Subversion control.
- Set file properties such that "^M" are removed during checkin if added:
find ./ -name "*.cpp" -exec svn propset svn:eol-style LF {} \;
- Apply property changes to repository: svn ci -m "Apply LF properties" local-directory
Note that the "propset" command must be used for new files
added to the Subversion repository if they are to have these
properties.
Users can also set this option in the file: $HOME/.subversion/config
-
.. ...
[auto-props] README = svn:eol-style=native INSTALL = svn:eol-style=native *.c = svn:eol-style=LF *.cpp = svn:eol-style=LF *.h = svn:eol-style=LF *.dsp = svn:eol-style=CRLF *.dsw = svn:eol-style=CRLF *.sh = svn:eol-style=native;svn:executable *.txt = svn:eol-style=LF *.png = svn:mime-type=image/png *.jpg = svn:mime-type=image/jpeg Makefile = svn:eol-style=LF *.html = svn:eol-style=LF *.css = svn:eol-style=LF *.java = svn:eol-style=LF *.xml = svn:eol-style=LF *.m4 = svn:eol-style=LF *.pdf = svn:mime-type=application/pdf
... ..
|
| Subversion Repository Transfer: |
Data repository dump:
- Dump first entry to current:
svnadmin dump /srv/svn/repos --revision 0:HEAD > repos.dump
- Dump revision 625 to current:
svnadmin dump /srv/svn/repos --revision 625:HEAD --incremental > repos-625.dump
Data repository load:
- First load: svnadmin load /srv/svn/repos < repos.dump
- Incremental load: svnadmin load /srv/svn/repos < repos-625.dump
For more complex transfers with path translation, see the
YoLinux Subversion repository data transfer tutorials.
The best presentation interface is "Insurrection" detailed below.
For a quick and easy improvement to the Subversion web interface, use the
XSLT file which comes with the "subversion-tools RPM".
Create path links:
- ln -s /usr/lib/subversion/tools/xslt/svnindex.xsl /var/www/html/
- ln -s /usr/lib/subversion/tools/xslt/svnindex.css /var/www/html/
Add the "SVNIndexXSLT" directive to the file /etc/http/conf.d/subversion.conf
-
LoadModule dav_svn_module modules/mod_dav_svn.so <Location /svn> DAV svn SVNPath /srv/svn/repos
SVNIndexXSLT "/svnindex.xsl"
</Location>
|
The XSLT reference can also be a full URL: SVNIndexXSLT "http://domain/path/svnindex.xsl"
For more information on the "subversion-tools" package see the
tools contrib page.
[Potential Pitfall]: Some browsers
(like Konquerer), do not process XSLT. This will prohibit them from traversing directories which are rendered with XSLT.
This is unfortunate as Konquerer has syntax highlighting for rendering many of the popular programming languages.
| Insurrection Installation and Configuration: |
Insurrection is a HTML, CSS and XSLT (and some perl) web pressentation layer for
Subversion. It creates an more functional and feature rich web interface to Subversion.
It does not support Opera or browsers without XSLT support. Supports IE/Mozilla and Firefox.
Installation:
- Download using Subversion: svn export http://svn.code-host.net/svn/Insurrection/trunk/
This will download Insurrection to a local directory called "trunk".
OR
- insurrection-100906.tar.gz
Installation:
- Move to web directory: mv trunk /var/www/Insurrection
- Edit files:
- insurrection.conf: Place this file in /etc/httpd/conf.d/
This Apache configuration files needs to be edited to suit your installation. This example is set to replace your /etc/httpd/conf.d/subversion.conf file. Do not duplicate functionality in both.
- insurrection.js: Edit SVN_URL per your Subversion repository.
- insurrection.pl:
Edit and set variables:
- SVN_REPOSITORIES_URL
- SVN_AUTH
- SVN_BASE
- Add a logo image file to your insurrection directory: /var/www/Insurrection/cm.megacorp.com.gif
Note: This is required as the logic checks for the existance of this
file to function properly. If using a port other than web port 80,
(i.e. port 222) then specify the port: /var/www/Insurrection/cm.megacorp.com:222.gif
- Edit the file /var/www/Insurrection/.htaccess for the gif logo path. May have to edit the SVN_URL location in insurrection.js.
Comment out lines referencing ls.cgi in RewriteCond and RewriteRule.
Note that Insurrection's default configuration is set to use a
virtual host or a dedicated server for Subversion. This is due to
"DocumentRoot" being set to "/". If using a different Apache
"DocumentRoot" configuration, edit the directory prefixes in insurrection.xsl.
Links:
| StatSVN: Subversion repository statistics and analytics |
StatSVN is a metrics-analysis tool which will provide web
reporting and charting of lines of code (LOC), developer activity, file
count, file size and project statistics based on Subversion repository
activity.
Install and Configure:
- Download the compressed compiled Java file statsvn-0.3.1.zip from sourceforge.
- Decompress and extract contents of zip file: unzip statsvn-0.3.1.zip
- Install Java program: mv statsvn-0.3.1/statsvn.jar /opt/bin/statsvn.jar
- Create the following cron job script:
/etc/cron.daily/StatSVN.sh
-
#!/bin/bash # # Generate the StatSVN web pages # if [ -d /usr/java/jdk1.6.0 ] then export PATH=/usr/java/jdk1.6.0/bin:$PATH export JAVA_HOME=/usr/java/jdk1.6.0 export CLASSPATH=/usr/java/jdk1.6.0/lib/tools.jar:./ else exit fi
# Update local Subversion repository # Uncomment this line if this script is to update the local working Subversion repository. # svn update /opt/Cabie/BUILDS/buildserver1/trunk
# Generate Subversion log file svn log -v --xml /opt/Cabie/BUILDS/buildserver1/trunk > \ /opt/Cabie/BUILDS/buildserver1/StatSVN/logfile.log
# Create web content here: cd /opt/Cabie/BUILDS/buildserver1/StatSVN
# Generate web content java -jar /opt/bin/statsvn.jar /opt/Cabie/BUILDS/buildserver1/StatSVN/logfile.log \ /opt/Cabie/BUILDS/buildserver1/StatSVN
|
Specify the correct directory paths for your configuration:
- Subversion local checkout directory: /opt/Cabie/BUILDS/buildserver1/trunk
(Our is located on our Cabie build server. See the YoLinux Cabie tutorial.)
- Path for Subversion metrics-analysis web pages created by StatSVN which is also accessible to the Apache web server: /opt/Cabie/BUILDS/buildserver1/StatSVN
- Temporary log file: /opt/Cabie/BUILDS/buildserver1/StatSVN/logfile.log
(Can also use /etc/logfile.log)
- [Potential Pitfall]: Cron jobs execute as root. You may have to specify an alternative login and password which has access to the Subversion repository. e.g.
svn log -v --xml --username userX --password supersecret /opt/Cabie/BUILDS/...
In this example the web content will be in /opt/Cabie/BUILDS/buildserver1/StatSVN. Apache must be configured to view this directory. See the
YoLinux Apache Web server configuration tutorials.
Note in this installation, our Cabie build server updates the local repository
after every check-in. If your repositry is not updated automatically, uncomment the line in the script to do so.
Links:
| Trac Server Installation and Configuration: |
RPM installation: (Red Hat Enterprise Linux 4 example)
- http://dag.wieers.com:
(Select: Home made + RPM repository + RPMforge)
- trac-0.9.6-1.el4.rf.noarch.rpm
- clearsilver-0.10.1-1.2.el4.rf.i386.rpm
- clearsilver-devel-0.10.1-1.2.el4.rf.i386.rpm
- python-clearsilver-0.10.1-1.2.el4.rf.i386.rpm
- python-imaging-1.1.5-5.el4.i386.rpm
- python-sqlite-1.0.1-1.2.el4.rf.i386.rpm
- sqlite-2.8.16-1.2.el4.rf.i386.rpm
- sqlite-devel-2.8.16-1.2.el4.rf.i386.rpm
- http://rpm.pbone.net:
- python-docutils-0.4-2.el4.noarch.rpm
or configure YUM and import from the DAG YUM repository.
See the YoLinux SysAdmin Tutorial: YUM
-
yum install -y trac
Ubuntu: apt-get install trac
Allow Trac CGI to be executed (Two methods. Pick one.):
- Copy the CGI to the default CGI bin directory: cp /usr/share/trac/cgi-bin/trac.cgi /var/www/cgi-bin
OR
- Enable Apache to execute the CGI:
-
.. ScriptAlias /trac /usr/share/trac/cgi-bin/trac.cgi ..
|
Note:The CGI trac.fcgi is for debugging using Python debugging.
As root: [root]# trac-admin /srv/trac/projectX initenv
-
Project Name [My Project]> projectX
Database connection string [sqlite:db/trac.db]>
Path to repository [/var/svn/test]> /srv/svn/projectX
Templates directory [/usr/share/trac/templates]>
Note:
- The directory /srv/trac MUST exist.
- The directory /srv/trac/projectX MUST not exist before execution of comand.
Trac repository directories:
- SuSE: /srv/trac/
- Red Hat: /usr/share/trac/proj_trac/
This command will initialize the Trac data repository and create a directory structure and default configuration files.
Allow paths and files to be accessible by Apache: [root]# chown -R apache:apache /srv/trac/projectX
SELinux:
- chcon -R -t httpd_sys_content_t /usr/share/trac/
- chcon -R -t httpd_sys_content_t /srv/trac/
Component Home pages:
File: /srv/trac/projectX/conf/trac.ini
(Created using the "trac-admin" command above and not provided by the RPM package.)
-
Specify project URL:
.. ...
[trac] ... repository_dir = /srv/svn/projectX - This ties Trac to Subversion
...
...
[notification]
Set email and SMTP information here
...
...
[project]
url = http://projectX.com
|
For more trac.ini configuration information see Trac: trac.ini configuration
[Potential Pitfall]: Once
Trac is configured and used (i.e. it has tickets, etc), it can not be
pointed to a different Subversion repository. If you point
"repository_dir" to a new Subversion repository, you will not have a
Trac database which is in sync with Subversion and Trac will fail. The
name of the directory path and the "repository_dir" can be renamed with
matching names, but the actual Subversion repository must remain the
same.
| Apache Web Server configuration file for Trac integration: |
Trac can be run using the stand-alone Trac daemon "tracd". This configuration shows the use of Apache with Trac.
File: /etc/httpd/conf.d/trac.conf
- This example performs no authentication:
Alias /trac/ "/usr/share/trac/htdocs/" <Location "/cgi-bin/trac.cgi"> SetEnv TRAC_ENV "/srv/trac/projectX" </Location>
|
- This example authenticates logins internally using Apache. User logins and passwords have no connection to user accounts.
Alias /trac/ "/usr/share/trac/htdocs/" <Location "/cgi-bin/trac.cgi"> SetEnv TRAC_ENV "/srv/trac/projectX" </Location>
# The following enables the "login" link in Trac. # (Top right hand corner)
<Location "/cgi-bin/trac.cgi/login"> AuthType Basic AuthName "Project X Trac" AuthUserFile /etc/httpd/conf/userpw require valid-user </Location>
|
For more on Apache user file authentication see:
- This example authenticates logins internally using Trac and Digest authentication.
User logins and passwords have no connection to user accounts.
Alias /trac/ "/usr/share/trac/htdocs/" <Location "/cgi-bin/trac.cgi"> SetEnv TRAC_ENV "/srv/trac/projectX" </Location>
# The following enables the "login" link in Trac. # (Top right hand corner)
<Location "/cgi-bin/trac.cgi/login"> AuthType Digest AuthName "Project X Trac" AuthDigestDomain /trac AuthDigestFile /etc/httpd/conf/digestpw require valid-user </Location>
|
For more on digest authentication see:
- This example authenticates user account logins with the NIS server.
This requires the installation of perl modules Apache-AuthenNIS.
See the YoLinux Apache NIS authentication tutorial
Alias /trac/ "/usr/share/trac/htdocs/" <Location "/cgi-bin/trac.cgi"> SetEnv TRAC_ENV "/srv/trac/projectX" AuthType Basic - Including the next 4 lines prohibits anonymous use of Trac
AuthName "Project X Trac"
PerlAuthenHandler Apache::AuthenNIS
PerlSerVar AllowAlternateAuth no
require valid-user
</Location>
# The following enables the "login" link in Trac.
# (Top right hand corner)
<Location "/cgi-bin/trac.cgi/login">
AuthType Basic
AuthName "Project X Trac"
PerlAuthenHandler Apache::AuthenNIS
PerlSerVar AllowAlternateAuth no
require valid-user
</Location>
|
Restart Apache: service httpd restart
Also see YoLinux Apache authentication tutorial: LDAP, NIS, File.
Issue Trac commands as root:
- Command line: trac-admin --help
OR
- Enter into Trac Admin shell: trac-admin /srv/trac/projectX
Then type "help" to see list of commands.
Use the command "quit" to exit the shell.
Set Permissions:
- Grant administration privileges to a user:
-
trac-admin /srv/trac/projectX permission add userid TRAC_ADMIN
These permissions are required if using web interface to manage "roadmaps".
- Show permissions:
-
trac-admin /srv/trac/projectX permission list user-id
- Remove write for anonymous users:
-
trac-admin /srv/trac/projectX permission remove anonymous TICKET_CREATE TICKET_MODIFY WIKI_CREATE WIKI_MODIFY
- Set default for authenticated users:
-
trac-admin /srv/trac/projectX permission add authenticated TICKET_CREATE TICKET_MODIFY TICKET_VIEW WIKI_CREATE WIKI_MODIFY
Add components to be managed by Trac:
- Roadmap/Product Milestones:
- trac-admin /srv/trac/projectX milestone add name-of-milestone YYYY-MM-DD
- trac-admin /srv/trac/projectX milestone completed name-of-milestone YYYY-MM-DD
(Where "YYYY-MM-DD" is the due date or completion date. i.e. 2006-11-17)
The milestones can be created using the web interface.
- Software Components: trac-admin /srv/trac/projectX component add name-of-component owner-id
Defaults for "New Ticket":
- Type: defect, enhancement, task
View using the command: trac-admin /srv/trac/projectX ticket_type list
Use "add" or "delete" to change the default.
- Priority: blocker, critical, major, minor, trivial
View using the command: trac-admin /srv/trac/projectX priority list
Use "add" or "delete" to change the default.
- Severity: highest, high, normal, low, lowest
View using the command: trac-admin /srv/trac/projectX severity list
Use "add" or "delete" to change the default.
Trac-Admin commands: trac-admin /path/to/projenv [command [subcommand] [option ...]]
-
| Command |
Description |
| about |
Shows information about trac-admin |
| help |
Show documentation |
| initenv |
Create and initialize a new environment interactively |
| initenv <projectname> <db> <repospath> <templatepath> |
Create and initialize a new environment from arguments |
| hotcopy <backupdir> |
Make a hot backup copy of an environment |
| resync |
Re-synchronize trac with the repository |
| upgrade |
Upgrade database to current version |
| wiki list |
List wiki pages |
| wiki remove <name> |
Remove wiki page |
| wiki export <page> [file] |
Export wiki page to file or stdout |
| wiki import <page> [file] |
Import wiki page from file or stdin |
| wiki dump <directory> |
Export all wiki pages to files named by title |
| wiki load <directory> |
Import all wiki pages from directory |
| wiki upgrade |
Upgrade default wiki pages to current version |
| permission list [user] |
List permission rules |
| permission add <user> <action> [action] [...] |
Add a new permission rule |
| permission remove <user> <action> [action] [...] |
Remove permission rule |
| component list |
Show available components |
| component add <name> <owner> |
Add a new component |
| component rename <name> <newname> |
Rename a component |
| component remove <name> |
Remove/uninstall component |
| component chown <name> <owner> |
Change component ownership |
| ticket_type list |
Show possible ticket types |
| ticket_type add <value> |
Add a ticket type |
| ticket_type change <value> <newvalue> |
Change a ticket type |
| ticket_type remove <value> |
Remove a ticket type |
| ticket_type order <value> up|down |
Move a ticket type up or down in the list |
| priority list |
Show possible ticket priorities |
| priority add <value> |
Add a priority value option |
| priority change <value> <newvalue> |
Change a priority value |
| priority remove <value> |
Remove priority value |
| priority order <value> up|down |
Move a priority value up or down in the list |
| severity list |
Show possible ticket severities |
| severity add <value> |
Add a severity value option |
| severity change <value> <newvalue> |
Change a severity value |
| severity remove <value> |
Remove severity value |
| severity order <value> up|down |
Move a severity value up or down in the list |
| version list |
Show versions |
| version add <name> [time] |
Add version |
| version rename <name> <newname> |
Rename version |
| version time <name> <time> |
Set version date (Format: "YYYY-MM-DD" or "now") |
| version remove <name> |
Remove version |
| milestone list |
Show milestones |
| milestone add <name> [due] |
Add milestone |
| milestone rename <name> <newname> |
Rename milestone |
| milestone due <name> <due> |
Set milestone due date (Format: "YYYY-MM-DD" or "now") |
| milestone completed <name> <completed> |
Set milestone completed date (Format: "YYYY-MM-DD" or "now") |
| milestone remove <name> |
Remove milestone |
Invoking trac-admin without command starts interactive mode.
Use the command trac-admin /srv/trac/projectX wiki list to view Wiki entries.
-
| Display |
Trac/Wiki Format Code |
HTML Code Equivalent |
A forced line
break. |
A forced line[[br]]break. |
A forced line<br>break. |
| Bold text |
'''Bold text''' |
<b> </b> |
| Italic text |
''Italic text'' |
<i> </i> |
| Bold italic text |
'''''Bold italic text''''' |
<b><i> </i></b> |
| Underline |
__Underline__ |
<u> </u> |
| Monospace text |
{{{Monospace text}}}
or
`Monospace text` |
<tt> </tt> |
strike-through |
~~strike-through~~ |
<del> </del> |
| Textsuperscript |
^superscript^ |
<sup> </sup> |
| Textsubscript |
,,subscript,, |
<sub> </sub> |
| ''' |
!'''
The "!" escapes the Trac Wiki parser. |
|
Heading
|
= Heading = |
Same as HTML "h1" |
Subheading
|
== Subheading == |
Same as HTML "h2" |
Smaller subheading
|
===Smaller subheading=== |
Same as HTML "h3" |
Text line 1
Text line 2 |
Text line 1[[BR]]Text line 2 |
HTML line break <br> |
- List item one
- List item two
|
* List item one * List item two * Nested item
Note: A blank space must be present before the "*".
|
HTML unordered list:
<ul>
<li>List item one</li>
<li>List item two
<ul>
<li>Nested item</li>
</ul></li>
</ul> |
- List item one
- Nested item
- List item two
- Nested item
|
1. List item one i. Nested item 2. List item two a Nested item
Note: A blank space must be present before the list item: "1"
|
HTML ordered list:
<ol>
<li>List item one
<ol type="lower-roman">
<li>Nested item</li>
</li>
<li>List item two
<ol type="lower-alpha">
<li>Nested item</li>
</ol></li>
</ol> |
| Cell 1 |
Cell 2 |
Cell 3
|
| Cell 4 |
Cell 5 |
Cell 6 |
|
||Cell 1||Cell 2||Cell 3|| ||Cell 4||Cell 5||Cell 6||
|
<table border>
<tr><td>Cell 1</td><td></td>Cell 2</td><td></td>Cell 3</td></tr>
<tr><td>Cell 4</td><td></td>Cell 5</td><td></td>Cell 6</td></tr>
</table>
|
|
[[Image(http://URL-goes-here/images/image-file.gif)]]
(URLs ending in .png, .gif or .jpg are interpreted as image links. See "Creating Wiki links" below)
|
<img src="http://URL-goes-here/images/image-file.gif> |
For more information on Trac Wiki formatting, see WikiFormatting
Creating Wiki links:
- Web URL: [http://URL-goes-here Link text goes here]
(Traditional HTML link)
- Create a link to a Trac Milestone:
- milestone:1.2
- milestone:"Release maui"
- Create link to Subversion for given revision changeset:
- [subversion-revision-number-goes-here]
- r207, r209
- changeset:207
Prefix the Subversion revision number with the letter "r" to have Wiki
formatting create a link to the Subversion revision logs.
- Create link to Subversion revision logs:
- r3:5
- [3:5]
- log:branches/version6.2-beta#3:5
Where "version6.2-beta" is the name of the branch for which logs are to be reported.
- Create link to Trac ticket:
- #ticket-number-goes-here
- #45
Note: To escape the "#" without making it a link, prefix with a "!". i.e. !#45 will not generate a link.
- ticket:45
- Create link to a specific file:
- source:trunk/dira/dirb/file.cpp
- source:"trunk/dira/dirb/file with spaces.cpp"
(Files with spaces in the name should be encapsulated in quotes.)
- Create link to a specific revision of a file:
source:trunk/dira/dirb/file.cpp#207
- Create link to a report:
- {report-number-goes-here}
- report:report-number-goes-here
- Create link to Wiki page: CamelCaseStringGoesHere
This becomes a link to an HTML page of the same name.
- Link to a Trac Wiki attachment: attachment:pressentation.ppt
Use the command trac-admin /srv/trac/projectX wiki list to view Wiki entries.
One can access the Trac SQLite database directly:
-
Sample session: (response not included)
[prompt]$ cd /srv/trac/projectX/db [prompt]$ sqlite trac.db sqlite> .help sqlite> .tables sqlite> .schema ticket sqlite> SELECT * FROM ticket; sqlite> .exit
|
Backup and restore:
-
Dump database:
[prompt]$ cd /srv/trac/projectX/db [prompt]$ sqlite trac.db sqlite> .outfile /tmp/trac.sql sqlite> .dump sqlite> .exit
|
Load database:
[prompt]$ cd /srv/trac/projectX/db [prompt]$ rm trac.db [prompt]$ sqlite trac.db sqlite> .read /tmp/trac.sql sqlite> .exit [prompt]$ trac-admin trac resync
|
Trac database schema
Trac can assign new tickets (bugs/enhancements) to developers
registered in the system. It can also communicate via email. To
register, a user must login to Trac and:
- Select the "Settings" link at the top right hand side of the web page.
- Enter your name and email address.
After an upgrade to Trac, the configuration and data files you employ must also
be upgraded. The RPM upgrades miss this so perform manually:
-
trac-admin /srv/trac/projectX upgrade
Also see /usr/share/doc/trac-... for local documentation.
Trac plugins are available to enhance Trac functionality.
The plugins require some Python infrastructure for installation.
Install the Python package "setuptools" which includes command "easy_install".
The following is an example for Red Hat Enterprise 4 / CentOS 4.
Use one of the following two methods to install the command "/usr/bin/easy_install":
- Python script:
- Download the Python script http://peak.telecommunity.com/dist/ez_setup.py
- Run: python ez_setup.py
This will download and run the script: setuptools-0.6c6-py2.3.egg
which installs "easy_install".
- Egg script:
- Download: http://cheeseshop.python.org/packages/2.4/s/setuptools/setuptools-0.6c6-py2.4.egg
- As root: chmod +x setuptools-0.6c6-py2.3.egg
- Run: ./setuptools-0.6c6-py2.3.egg
| Trac "webadmin" plugin installation: |
This will no longer be required with Trac version 0.10 or later as it will be integrated into the Trac.
Installation:
- Use Subversion to download latest webadmin plugin software:
-
svn export http://svn.edgewall.com/repos/trac/sandbox/webadmin/
This will create the directory webadmin/ and its contents.
- cd webadmin
- Install Trac plugin: easyinstall .
If installing from an egg file:
- mv TracWebAdmin-0.1.2dev_r4240-py2.3.egg.zip TracWebAdmin-0.1.2dev_r4240-py2.3.egg
- easy_install TracWebAdmin-0.1.2dev_r4240-py2.3.egg
Direct Trac to employ the component "webadmin". Add to end of file: /srv/trac/ProjectX/conf/trac.ini
-
... ..
[components] webadmin.* = enabled
|
Apache configuration modification. File: /etc/httpd/conf.d/trac.conf
-
<Location "/trac"> SetEnv TRAC_ENV "/srv/trac/sgec" SetEnv PYTHON_EGG_CACHE /srv/trac/sgec/egg_cache
... .. </Location>
|
Create cache directory:
- mkdir /srv/trac/ProjectX/egg_cache
- chown apache.apache /srv/trac/ProjectX/egg_cache
Restart apache: service httpd restart
Test to see if plugin has been installed: python -c "import webadmin"
The proper response is no output. Error reponse: "ImportError: No module named webadmin"
The final step is to add the Trac administrator privileges:
-
trac-admin /srv/trac/ProjectX permission add user1 TRAC_ADMIN
Users who have been given "TRAC_ADMIN" privileges, will see an
extra tab in the Trac toolbar interface labeled "Admin". Select this
tab to access the "webadmin" interface to Trac. This interface will
allow you to create components, associate components with roadmaps,
etc.
Documentation:
| Hosting Multiple Subversion and Trac repositories: |
SVN Hosting and Multiple Subversion Repositories with Apache:
One can have multiple Subversion repositories on one server. It is encouraged
for separate projects. Subversion increments the revision number for each
check-in in the repository and it makes the most logical sense to track revisions for
a logically grouped set of applications or even a single application.
If you want, you can even have a
separate repository which links other projects in separate repositories and
servers to look logically as one. (See Subversion property svn:externals)
Create repository locations:
- svnadmin create --fs-type fsfs /srv/svn/reposX
- svnadmin create --fs-type fsfs /srv/svn/reposY
- svnadmin create --fs-type fsfs /srv/svn/reposZ
- ...
Each repository would have a separate "Location" defined in the Apache configuration:
-
LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /reposX> DAV svn SVNPath /srv/svn/reposX ... .. </Location> <Location /reposY> DAV svn SVNPath /srv/svn/reposY ... .. </Location> <Location /reposZ> DAV svn SVNPath /srv/svn/reposZ ... .. </Location>
|
All the following URLs would be available:
- http://domain/reposX/
- http://domain/reposY/
- http://domain/reposZ/
or specify the "SVNParentPath":
LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /svn> DAV svn SVNParentPath /srv/svn ... .. </Location>
|
All the following URLs would be available:
- http://domain/svn/reposX/
- http://domain/svn/reposY/
- http://domain/svn/reposZ/
Multiple Trac repositories:
Define a Trac parent directory under which you may locate multiple instances of Trac:
-
ScriptAlias /trac /usr/share/trac/cgi-bin/trac.cgi
<Location "/trac"> SetEnv TRAC_ENV_PARENT_DIR "/srv/trac/trac_projects" AuthType Basic AuthName "Trac" AuthUserFile /srv/passwd/trac.htpasswd Require valid-user </Location>
<LocationMatch "/trac/[^/]+/login"> AuthType Basic AuthName "Trac" AuthUserFile /srv/passwd/trac.htpasswd Require valid-user </LocationMatch>
|
Note:
- All trac repositories reside under /srv/trac/trac_projects
i.e. /srv/trac/trac_projects/projectX, /srv/trac/trac_projects/projectY, etc
Web URL: http://server-name/trac/projectX
- This example uses file authentication as defined in /etc/httpd/conf.d/subversion.conf
AccessFileName /srv/passwd/trac.htpasswd
<Directory /srv/passwd> Options -Indexes -FollowSymLinks AllowOverride None </Directory>
|
Trac and multiple Subversion repositories and Multiple Trac instances:
If using Trac with Subversion, you will be required to create separate Trac instances.
Trac can use InterTrac Links to refer to resources of other Trac instances or servers, from within the Wiki markup.
Trac can also have a global "trac.ini" file used for multiple instances of Trac.
Also see:
Proposals such as MultiTrac are not available.
| Subversion Read-Only Access: |
Repositories and directory branches can be configured as read-only.
Apache configuration to use granular Subversion rules: /etc/httpd/conf.d/subversion.conf
-
<Location /svn>
DAV svn
SVNParentPath /srv/svn
AuthzSVNAccessFile /srv/config/svn_granular_rules
...
...
</Location>
|
The inclusion of the "AuthzSVNAccessFile" Apache module directive, directs granular access control to the file "/srv/config/svn_granular_rules".
Granular directory level access rules: /srv/config/svn_granular_rules
-
[projectX:/tags]
* = r
userx = rw
[projectX:/]
* = rw
[projectY:/]
* = rw
|
Once granular access control has been assigned to this control file, all projects must have access assignments or none will be granted by default.
This rule set enforces read-only access to the "tags" branch except for "userx" who has read and write access to the "tags" branch.
All other repositories under the "SVNParentPath" must be listed.
The "*" refers to all users.
Of course it is easiest to turn off Security Enhanced Linux features by:
- editing the file /etc/selinux/config, setting "SELINUX=disabled" and reboot
OR
- use the command "setenforce 0".
If using SELinux, you must set the context of the content accessed by the server:
-
chcon -R -h -u system_u -r object_r -t httpd_sys_content_t /srv/svn /srv/trac
For more on SELinux see the YoLinux SysAdmin Tutorial
Books: |
-
|