= Trac on SuSE Linux Enterprise 9 '''Warning: Read the generic TracInstall instructions for the up-to-date installation instructions. In particular, the following instructions were current when Trac was at version 0.9''' '''Update: These instructions also work with Trac 0.10.3.1, Subversion 1.3.2 and !ClearSilver 0.10.4''' My particular scenario is a dual EM64T Xeon (x86_64) machine. It may be possible to optimize the binaries with some `-march=nocona` trickery. The configure scripts may already be taking care of this. I tried to find a configuration that would be 100% YaST-able with official packages, but the most substantial problems I found were: * The obvious absence of a Trac package * The pysqlite library is not included in the Python packages, nor is it available in an additional package. * The !ClearSilver library is not available in any package * The Python/SWIG bindings are not configured in the Subversion package The [http://developer.novell.com/wiki/index.php/SLES_SDK Novell SLES SDK] would be a good starting point, but it seems that the only relevant package is the Subversion RPM that lacks SWIG support. Coupled with the other dependencies, I realized I had to build some things from the ground up. The following is a Apache/mod_python based installation. == YaST-able prerequisites In an attempt to keep as much as possible under the system management outlined by SuSE and YaST, the following packages were used: * '''apache2''' 2.0.49-27.8 * '''apache2-prefork''' 2.0.49-27.8 * '''apache2-devel''' 2.0.49-27.8 * '''libapr0''' 2.0.49-27.8 * '''apache2-mod_python''' 3.1.3-37.1 * '''python''' 2.3.3-88.1 * '''python-devel''' 2.3.3-88.1 * '''zlib-devel''' 1.2.1-70.12 I used apache2-prefork because I also use PHP4, which is not recommended for use with Apache2-worker due to threading issues. Apache2-devel provides APXS2, which is used in setting up the Apache modules for Subversion. Python-devel is required to use distutils, which are used in setting up Pysqlite. zlib-devel is required for ClearSilver 10.4 (http://tech.groups.yahoo.com/group/ClearSilver/message/761). == Package Build Order The build/install order is somewhat flexible, since Trac has a number of first-level dependencies, rather than a chain. This order is rather arbitrary. You may also choose different versions, within the limits of the support of Trac. I know the versions I used here work cleanly. '''Note''': I was relatively cavalier regarding installation and library paths, some being in the more traditional `/usr/local`, some finding their way to `/usr/lib64`, and so on. You may wish to specify `--prefix=[somewhere]` for all `./configure` scripts and decide where better to place things. === SQLite (3.27 and 3.3.13 known to be ok) (http://www.sqlite.org/download.html) This configure is straight-forward: {{{ ./configure make make install }}} === Pysqlite (2.0.5 and 2.3.3 known to be ok) (http://initd.org/pub/software/pysqlite/releases/2.0/2.0.5/ and http://initd.org/tracker/pysqlite) The pysqlite installation requires distutils, which are packaged with python-devel. If you get some strange error messages, check this first. If you have installed your SQLite somewhere other than `/usr/local`, you'll have to modify setup.cfg accordingly. The library should automatically be installed in your `/usr/lib64/python2.3/site-packages` directory. {{{ python setup.py build python setup.py install }}} === !ClearSilver (http://www.clearsilver.net/downloads/) '''Note''': the use of !ClearSilver has been deprecated in favor of Genshi. ==== !ClearSilver 0.10.4 The problem with Python configuration (see 0.10.2 and the patch for it) has been solved. !ClearSilver 0.10.4 can be built like the following: {{{ ./configure --enable-gettext --disable-csharp --disable-ruby \ --disable-perl --disable-java --disable-apache make make install }}} ==== !ClearSilver 0.10.2 Some of the problems with 0.9.3 (below) have been fixed in this release, but a couple have not been fixed. Please see [wiki:TracOnSLES9ClearSilverFix] for more information, as well as a patch that makes this work. ==== !ClearSilver 0.9.3 I used 0.9.3 because it was the lowest version that was required by Trac. I initially tried to install the newest (0.10.1), but the configure was balking at the target of x86_64-unknown-linux-gnu. There is apparently a patch that can be applied to work around this, but I did not use it. As with the other C packages, the `configure` parameters should include `--prefix=[your_location]` if you are installing somewhere outside the default. You must also pass the `--with-python=[path/bin/python]` parameter to set up the python bindings. Caveats with the !ClearSilver build: 1. You may have to pass `-fPIC` as part of your CFLAGS. This is apparently required for x86_64 support. I don't pretend to understand all of the architecture details, but the compiler told me to recompile with `-fPIC`, so I did and all is seemingly well. 1. You may have to make a modification to the setup.py when installing the Python bindings. In my setup, the `-c` flag was passed to gcc along with `-o`, which is prohibited. I simply remove `-c` from the CFLAGS, per a newsgroups post (http://groups.yahoo.com/group/ClearSilver/message/242). ==== Add the following line to the python/setup.py file, around line 70 {{{ os.environ["CFLAGS"] = os.environ["CFLAGS"].replace('-c', '') }}} It should be after these lines: {{{ INC_DIRS = expand_vars(INC_DIRS, make_vars) LIB_DIRS = expand_vars(LIB_DIRS, make_vars) LIBRARIES = expand_vars(LIBRARIES, make_vars) }}} And before these lines: {{{ setup(name="clearsilver", version=VERSION, description="Python ClearSilver Wrapper", author="Brandon Long", }}} ==== Build and install the !ClearSilver libraries {{{ CFLAGS=-fPIC ./configure --with-python=/usr/bin/python CFLAGS=-fPIC make make install }}} == Subversion (1.2.3 or 1.3.2) (http://subversion.tigris.org/downloads/subversion-1.2.3.tar.gz or http://subversion.tigris.org/downloads/subversion-1.3.2.tar.gz) Subversion 1.4 doesn't fit SLES9 well, because it needs a newer libapr0. The build of Subversion is pretty simple once the other details are out of the way, but there are some SuSE-specific configuration things that must be cleaned up. In my case, make install broke unless I created the previously non-existent http2-prefork.conf. The install script must be determining this path somehow with APXS, but I haven't taken the time to completely understand what it's calculating, and how it diverges from the actual configuration. There are also some things that seem to fall through the cracks regarding the libraries. My procedure was: === Create `/etc/apache2/httpd2-prefork.conf` and add a bogus !LoadModule directive {{{ ###Subversion/apxs install script workaround: LoadModule foo /bar.so }}} === Perform the normal installation You may want to use some additional parameters, but this is what I used: {{{ ./configure --with-zlib --with-swig --with-apxs=/usr/sbin/apxs2 make make install }}} === Build and install the swig-py bindings to `/usr/lib64/python2.3/site-packages` You should make sure swig-py bindings get installed into this directory (by default, they are installed to $(prefix_dir)/lib), so that Python could find them. {{{ make swig_pydir=/usr/lib64/python2.3/site-packages \ swig_pydir_extra=/usr/lib64/python2.3/site-packages \ swig-py make swig_pydir=/usr/lib64/python2.3/site-packages \ swig_pydir_extra=/usr/lib64/python2.3/site-packages \ install-swig-py }}} === Copy the C library to `/usr/lib64` and update the library cache If you used a different prefix, substitute it for `/usr/local` in these steps: {{{ cp /usr/local/lib/libsvn_swig_py-1.so.0.0.0 /usr/lib64 ln -s /usr/lib64/libsvn_swig_py-1.so.0.0.0 /usr/lib64/libsvn_swig_py-1.so.0 ldconfig }}} == Trac (0.9b2 or 0.10.3.1) (http://ftp.edgewall.com/pub/trac/trac-0.9b2.tar.gz or http://ftp.edgewall.com/pub/trac/trac-0.10.3.1.tar.gz) At this point, the Trac installation should be as simple as on any other platform. I used the default installation path `/usr/share/trac`. {{{ python setup.py install }}} == Additional Setup You should refer to TracInstall first, but I'll describe my somewhat-overlapping process for finishing the setup of the Apache/mod_python installation. === Pick a place for your Subversion project repository (if you do not have an existing one) I like `/var/svn` to house my respositories and `/var/svn/conf` to hold the configs for them. Select anywhere that seems reasonable to you. You create the repository with svnadmin: {{{ svnadmin create /var/svn/project }}} === Pick a place for your Trac project environment I like `/var/trac` for my Trac environments. As with the Subversion home, select anywhere that seems reasonable to you. Trac environments are created with trac-admin: {{{ trac-admin /var/trac/project initenv }}} You will have to answer a small handful of questions about the project, entering a name, connection string, shared trac directory and repository location. Having installed trac to the default of `/usr/share/trac`, and using SQLite for my data store, I entered the project name and path to the Subversion repository, leaving defaults for the other two questions. === Set up Apache to work with the rest of your toys In order for everything to work, you need to make some modifications to your Apache configuration. Assuming everything is in the SuSE default locations, you'll need to modify some parameters in `/etc/sysconfig` and create a configuration for your project. I decided to configure Subversion fully in its own right, rather than only using the Trac functionality. Most installations will be similar. ==== Add the handful of DAV/SVN related modules to the APACHE_MODULES variable in /etc/sysconfig/apache2 You should make sure the list contains dav, dav_fs, dav_svn, authz_svn and Python. ==== Add a directory to APACHE_CONF_INCLUDE_DIRS to catch your project-specific configurations I used `/etc/apache2/my_conf/*.conf`, so any *.conf files in that directory are included at startup/rehash. You could be more specific by using APACHE_CONF_INCLUDE_FILES, or a more restrictive file mask, but I find this to be convenient. ==== Create a basic htpasswd file for the Subversion repository and Trac installation As seems to be the case on multiple projects, I like to keep my Subversion and Trac authentication synchronized, and an easy way to do that is to use the same htpasswd file. I place it in `/svn/conf/[project]users`. You can add the first user with: {{{ htpasswd2 -c /svn/conf/someprojectusers }}} ==== Add a configuration file for your project to `/etc/apache2/my_conf` This is where you actually set up your Subversion and Trac access. Here is a basic setup that will get both Subversion and Trac up and running off of the same htpasswd file: {{{ DAV svn SVNPath /var/svn/someproject AuthType Basic AuthName "Some Project Repository" AuthUserFile /var/svn/conf/someprojectusers Require valid-user Alias /trac "/usr/share/trac/htdocs" SetHandler mod_python PythonHandler trac.web.modpython_frontend PythonOption TracEnv /var/trac/someproject PythonOption TracUriRoot /someproject AuthType Basic AuthName "Trac - Some Project" AuthUserFile /var/svn/conf/someproject Require valid-user }}} ==== Make sure that your Apache user has access to the repository and Trac environment On my installation, `wwwrun` is the Apache user, so `chown -R wwwrun:root /var/svn /var/trac` was used. You may have some additional permissions to implement on top of these, but they should get you started. ==== Reload Apache `/etc/init.d/apache2 reload` should take care of pulling in the new configuration and setting up both the Subversion and Trac access. === Conclusion Customization for virtual hosts, different authentication, and so on should follow typical Trac behavior. -------- See also: [wiki:TracOnSuSE TracOnSuSE], TracInstall