---

Apache 2.0.61 / SSL, Subversion 1.4.6, Trac 0.11 on SuSE Linux 10.x

This article describes the installation of a subversion repository server including Trac Project Managment on a SuSE Linux 10.x Server.

What is Trac?

  • An integrated system for managing software projects
  • An enhanced wiki
  • A flexible web-based issue tracker
  • An interface to the Subversion revision control system

Or look at their homepage:Trac Project Managment.

Normally any linux distribution comes with precompiled packages. But if we want to use the Trac Project Managment we must compile the whole thing ourself.

System Description:

Standard SuSE linux 10.x server, installed in runlevel3. No graphical system is required because it is a repository server and nothing more ;-)

Systemrequirements:

Install the follwing packages via SuSE "YaST"

  • openssl
  • openssl-devel
  • autconf
  • libtool
  • db, db-devel
  • flex
  • bison
  • swig
  • libapr0
  • gcc-c++
  • gcc, make
  • glibc-devel
  • ctags
  • lzo, lzo-devel
  • gdbm, gdbm-devel
  • libxml2-devel
  • neon, neon-devel
  • sqlite, sqlite-devel
  • python, python-devel, python-XML, python-doc

Now we start with the compilation:

Download, compile and install Apache 2.0.61

$>cd /usr/local/src
$>wget http://www.eu.apache.org/dist/httpd/httpd-2.0.61.tar.gz
...
$>tar xzvf httpd-2.0.61.tar.gz
$>cd httpd-2.0.61
$>./buildconf
$>./configure \
  --enable-mods-shared="most ssl dav" \
  --enable-maintainer-mode \
  --enable-cgi \
  --enable-dav \
  --enable-dav-lock \
  --enable-dav-fs \
  --enable-deflate \
  --enable-auth-digest \
  --enable-rewrite \
  --enable-action \
  --enable-so \
  --enable-ssl \
  --enable-module=shared
$>make
$>make install

We generate an SSL certificate for the Webserver:

$>cd /usr/local/apache2/conf
$>mkdir ssl.crt ssl.key
$>openssl req -new -x509 -days 3650 -keyout ./ssl.key/
server.key -out ./ssl.crt/server.crt -subj '/CN=
host.domain Certificate'
...
$>cp ssl.key/server.key ssl.key/server.key.org
$>openssl rsa -in ssl.key/server.key.org -out ssl.key/
server.key
...
$>chmod 400 ssl.key/server.key
$>chmod 400 ssl.key/server.key.org

Download, compile and install Subversion 1.4.6

$>cd /usr/local/src
$>wget http://subversion.tigris.org/downloads/subversion-1.4.6.tar.gz
...
$>tar xzvf subversion-1.4.6.tar.gz
$>cd subversion-1.4.6
$>rm -rf /usr/local/lib/libsvn*
$>rm -rf /usr/local/lib/libapr*
$>rm -rf /usr/local/lib/libexpat*
$>rm -rf /usr/local/lib/libneon*
...
$>./configure \
  --enable-maintainer-mode \
  --with-ssl \
  --with-neon=/usr \
  --with-apr=/usr/local/apache2 \
  --with-apr-util=/usr/local/apache2 \
  --with-apxs=/usr/local/apache2/bin/apxs \
  --with-zlib \
  --with-swig=/usr/bin/swig \
  --enable-swig-bindings=all \
  PYTHON2=/usr/bin/python \
  PERL=/usr/bin/perl \
  --without-jdk \
  --without-jikes \
  --without-junit
$>make
$>make install
$>make swig-py
$>make install-swig-py
$>make swig-pl
$>make install-swig-pl
$>echo /usr/local/lib/svn-python > /usr/lib/python/site-packages/svn-python.pth

Download, compile and install Ruby 1.9.0

$>cd /usr/local/src
$>wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.0-0.tar.gz
$>tar xzvf ruby-1.9.0-0.tar.gz"
$>cd ruby-1.9.0-0
...
$>./configure
$>make
$>make install

Download, compile and install Pysqlite 2.4.0

$>cd /usr/local/src
$>wget http://initd.org/pub/software/pysqlite/releases/2.4/2.4.0/pysqlite-2.4.0.tar.gz
...
$>tar xzvf pysqlite-2.4.0.tar.gz
$>cd pysqlite-2.4.0
$>python setup.py build
$>python setup.py install

Download, compile and install Clearsilver 0.10.5

$>cd /usr/local/src
$>wget http://www.clearsilver.net/downloads/clearsilver-0.10.5.tar.gz
...
$>tar xzvf clearsilver-0.10.5
$>cd clearsilver-0.10.5
$>vi scripts/document.py (change the first line
to "/usr/bin/python" instead of /bin/env python)
...
$>./configure \
  --with-apache=/usr/local/apache2 \
  --with-python=/usr/bin/python \
  --disable-csharp \
  --disable-java \
  --enable-gettext
$>make
$>make install
$>cd python
$>python setup.py install
  (That should install the Python bindings for ClearSilver)

Download, compile and install Docutils latest snapshot

$>cd /usr/local/src
$>wget http://docutils.sourceforge.net/docutils-snapshot.tgz
...
$>tar xzvf docutils-snapshot.tgz
$>cd docutils
$>python setup.py build
$>python setup.py install
$>cd /tools
$>./buildhtml.py ../

Download, compile and install Trac 0.11

$>cd /usr/local/src
$>wget http://ftp.edgewall.com/pub/trac/Trac-0.11.tar.gz
$>tar xzvf  Trac-0.11.tar.gz
$>cd Trac-0.11
$>python ./setup.py install
This will byte-compile the python source code and install it in the site-packages directory of your python installation. The directories cgi-bin, templates, htdocs and wiki-default are all copied to $prefix/share/trac. The script will also install the trac-admin command-line tool, used to create and maintain project environments. Trac-admin is the command center of Trac.

Create user and group for Subversion:

$>groupadd svn-grp
$>useradd svn -G svn-grp -s /bin/bash
$>passwd svn (some password for user svn)

Create a Subversion Repository:

$>mkdir /data
$>mkdir /data/repos
$>chown -R svn.svn-grp /data/*
...
$>now login as user "svn" !!!
 	(you are now user svn) !!!
$>svnadmin create /data/repos/MyProject --fs-type fsfs
$>svn mkdir file:///data/repos/MyProject/trunk -m "trunk"
...
$>su root (type password for root)
 	(you are now user root) !!!

Create a Trac Enviorment from the Repository:

$>trac-admin /data/repos/MyProjectTrac initenv
 (change: Project Name [My Project]> to MyProject)
	(change: Path to repository [/var/svn/test]> to /data/repos/MyProject)
$>chgrp -R svn-grp /data/repos/
$>chmod -R 770 /data/repos/

Enable the Project Enviorment and start Apache2:

Change and add the following lines to your configuration:
$>vi /usr/local/apache2/conf/httpd.conf
  (change the Apache user to "svn")
  (change the Apache group to "svn-grp")
...
add the following lines to point to your project:
------------------
SetEnv PYTHON_EGG_CACHE /home/svn
ScriptAlias /trac /usr/share/trac/cgi-bin/trac.cgi
<Location "/trac">
	SetEnv TRAC_ENV "/data/repos/MyProject"
</Location>
------------------
  (save the configuration and start Apache2 like)
$>/usr/local/apache2/bin/apachectl start
Open your webbrowser and look if everything works. Type "http://yourip-or-domain/trac". If everything is perfect you can see the welcome message. Also have a look at the "Browse Source" button, there you can see the added subversion "trunk" directory.

Authentication for user login:

Change and add the following lines to your configuration:
$>cd /data/repos
$>touch svn-auth-file
$>chown svn.svn-grp svn-auth-file
$>chmod 440 svn-auth-file
...
add all user who should have access to the repository via:
$>htpasswd2 -cb /data/repos/svn-auth-file user password

and change the Location settings in  httpd.conf:
------------------
<Location /trac>
  DAV svn
  SVNPath       /data/repos/MyProject
  AuthType Basic
  AuthName "Subversion repository"
  AuthUserFile /data/repos/svn-auth-file
  Require valid-user
</Location>
------------------
  (save the configuration and restart Apache2)
$>/usr/local/apache2/bin/apachectl stop
$>/usr/local/apache2/bin/apachectl startssl
Don`t forget to change "ssl.conf" and "httpd.conf" if you use ssl!

sample ssl.conf:

SSLRandomSeed startup builtin
SSLRandomSeed connect builtin

<IfDefine SSL>
Listen 443

AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl    .crl

SSLPassPhraseDialog  builtin
SSLSessionCache         dbm:/usr/local/apache2/logs/ssl_scache
SSLSessionCacheTimeout  300
SSLMutex  file:/usr/local/apache2/logs/ssl_mutex

<VirtualHost _default_:443>
DocumentRoot "/usr/local/apache2/htdocs"
ServerName server.domain:443
ServerAdmin email@domain.com
ErrorLog /usr/local/apache2/logs/error_log
TransferLog /usr/local/apache2/logs/access_log

SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile /usr/local/apache2/conf/ssl.crt/server.crt
SSLCertificateKeyFile /usr/local/apache2/conf/ssl.key/server.key

<FilesMatch "\.(cgi|shtml|phtml|php3?)$">
    SSLOptions +StdEnvVars
</FilesMatch>
<Directory "/usr/local/apache2/cgi-bin">
    SSLOptions +StdEnvVars
</Directory>
SetEnvIf User-Agent ".*MSIE.*" \
         nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0
CustomLog /usr/local/apache2/logs/ssl_request_log \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
    RewriteEngine on
    RewriteCond   %{REQUEST_METHOD} ^(TRACE|TRACK)
    RewriteRule   .* - [F]
</VirtualHost>

</IfDefine>

Upgrade Trac Wiki:

$>trac-admin /link/to/tracdir wiki upgrade

Errors if you start Apache2 ?:

If you got some error like:
Cannot load /usr/lib/apache2-prefork/mod_dav_svn.so into server:/usr/lib/apache2-prefork/mod_dav_svn.so: undefined symbol: dav_xml_get_cdata...

Change in "/etc/sysconfig/apache2" from:
APACHE_MODULES="actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user authn_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl suexec userdir php5"

To:
APACHE_MODULES="actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user authn_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl suexec userdir php5 dav mod_dav_svn mod_authz_svn"

<<<------------>>> that`s it <<<------------>>>