Difference between revisions of "Trac"

From Univention Wiki

Jump to: navigation, search
(Einrichtung Weiterleitung)
Line 1: Line 1:
{{Version|UCS=2.4}}
+
#REDIRECT [[Cool Solution - Trac for UCS 3.0]]
 
 
'''Note:''' This article applies only to UCS 2.4. For installing Trac on UCS 3.x read [[Trac_for_UCS_3.0|Trac for UCS 3.0]]
 
 
 
To manage and document a subversion (SVN) repository and to easily gather information about errors, the project '''trac''' exists. With trac you can manage projects and milestones and assign tasks to users (similar to bugzilla). This article describes the installation and configuration of trac in an UCS environment.
 
 
 
== Installation ==
 
 
 
You will need to compile some packages by hand to fit them into your current UCS installation. For this, two repositories need to be added.
 
 
 
=== Adding new repositories ===
 
 
 
When installing trac on your system, you need to download the source code from the Debian repository:
 
<pre>
 
echo "# Debian Lenny main source repository \\
 
deb-src http://ftp.debian.org/debian lenny main" > /etc/apt/sources.list
 
</pre>
 
 
 
You will also need to enable the UCS unmaintained repository:
 
<pre>
 
univention-config-registry set repository/online/unmaintained=yes
 
</pre>
 
 
 
=== Building and installation of trac and its dependencies ===
 
 
 
First you need to install new modules for the Apache webserver:
 
<pre>
 
univention-install libapache2-mod-python libapache2-mod-python-doc python-clearsilver python-subversion subversion
 
</pre>
 
 
 
After the installation is completed, create a new folder '''trac''' and change into it:
 
<pre>
 
mkdir ~/trac
 
cd ~/trac
 
</pre>
 
 
 
Now, to build trac, you need to download the source code from trac and its dependencies:
 
<pre>
 
apt-get source trac python-pysqlite2 python-genshi libjs-jquery
 
</pre>
 
 
 
The dependencies must be installed in the correct order to prevent error messages. The process for all packages will be the same: installing the build-dependencies, build the package and install it:
 
<pre>
 
apt-get build-dep libjs-jquery
 
cd jquery-<version>
 
fakeroot dpkg-buildpackage
 
cd ..
 
dpkg -i libjs-jquery_<version>.deb
 
apt-get build-dep python-pysqlite2 python-genshi
 
cd genshi-<version>
 
fakeroot dpkg-buildpackage
 
cd ../python-pysqlite2-<version>/
 
fakeroot dpkg-buildpackage
 
cd ..
 
dpkg -i *.deb
 
apt-get build-dep trac
 
cd trac-<version>/
 
fakeroot dpkg-buildpackage
 
cd ..
 
dpkg -i trac_<version>.deb
 
</pre>
 
 
 
If no error message came up, trac is now installed on your system.
 
 
 
To enable the Apache webserver to recognize and interpret Python files, the corresponding module must be enabled and the service be restarted:
 
<pre>
 
a2enmod python
 
invoke-rc.d apache2 restart
 
</pre>
 
 
 
== Configuration ==
 
 
 
To gain access to a trac hosted project, you first need to create a project and then publish it using either the shipped method by trac or via your Apache webserver.
 
 
 
=== Create a new project ===
 
 
 
This is a two-step process. First a SVN repository will be created:
 
<pre>
 
mkdir -p /var/trac/subversion
 
svnadmin create /var/trac/subversion
 
</pre>
 
 
 
Next, the project itself must be created:
 
<pre>
 
mkdir -p /var/trac/projects/<my-project>
 
trac-admin /var/trac/projects/<my-project> initenv
 
</pre>
 
 
 
=== Publishing a project ===
 
 
 
==== Using tracd ====
 
 
 
To test if the trac project can be accessed, use the tool '''tracd''' (provided by trac):
 
<pre>
 
tracd -s --port 8000 /var/trac/projects/<my-project>
 
</pre>
 
 
 
You should now be able to access the project by entering the server's IP address and port into your browser:
 
<pre>
 
http://<server-ip>:8000
 
</pre>
 
 
 
==== Using Apache2 ====
 
 
 
Using Apache's PAM module, it is possible to authenticate users against the LDAP. Also, using the Apache webserver gives the possibility to use a virtual host for your project.
 
 
 
To provide access to trac via the Apache webserver, a configuration must be created in this file: '''/etc/apache2/sites-available/<my-project>.conf''', containing the following content:
 
<pre>
 
<Location /<my-project>>
 
SetHandler mod_python
 
PythonInterpreter main_interpreter
 
PythonHandler trac.web.modpython_frontend
 
PythonOption TracEnv /var/trac/projects/<my-project>
 
PythonOption TracUriRoot /<my-project>/
 
</Location>
 
</pre>
 
 
 
The site must be enabled and the webserver be restarted:
 
<pre>
 
a2ensite <my-project>.conf
 
invoke-rc.d apache2 restart
 
</pre>
 
 
 
=== PAM authentication ===
 
 
 
To enable the Apache webserver to authenticate users against the LDAP, a new section must be added to the configuration file '''/etc/apache2/sites-available/<my-project>.conf''':
 
<pre>
 
<Location /<my-project>/login>
 
Order deny,allow
 
Allow from all
 
AuthBasicAuthoritative Off
 
AuthPAM_Enabled on
 
AuthPAM_Service httpd-trac
 
AuthName "trac"
 
AuthType Basic
 
require valid-user
 
</Location>
 
</pre>
 
 
 
A new configuration file '''/etc/pam.d/httpd-trac''' must be created for the PAM authentication to fully work with the following content:
 
<pre>
 
#PAM-file for trac
 
@include common-account
 
@include common-auth
 
</pre>
 
 
 
After creation, the Apache webserver must be restarted:
 
<pre>
 
invoke-rc.d apache2 restart
 
</pre>
 
 
 
[[Category:Howtos]]
 
[[Category:EN]]
 

Revision as of 07:31, 23 May 2014

Personal tools