= Trac on SuSE Linux Enterprise 9 = '''Warning: always start by reading the generic TracInstall instructions, which contains 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''' There are a number of reasons that setting up a Trac installation on SLES9 is somewhat painful. This documentation is meant to alleviate some of this pain, outlining what was an effective process for me. My particular scenario is a dual EM64T Xeon (x86_64) machine, which complicated things only slightly, in my experience. It may be possible to optimize the binaries with some -march=nocona trickery, but I haven't been so daring to date. The configure scripts may already be taking care of this. I tried to find a configuration that would be 100% YaST-able (with offical packages), but fell a bit short. 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 I had thought the Novell SLES SDK (http://developer.novell.com/wiki/index.php/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. '''NOTE:''' Since I already have existing installations of Trac on Apache/mod_python, that is the most familiar configuration for me. You may want to use FastCGI, lighttpd, or some other configuration. The steps here should still be applicable for building the required components for Trac. Things will be a little different on 32-bit systems and may even be different for AMD 64-bit platforms. Use what helps you and contribute what might help others. = 1. YaST-able Prerequisites = In an attempt to keep as much as possible under the system management outlined by SuSE and YaST, I used packaged versions of Apache, Python, and mod_python. The packages and versions I used were: * '''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). = 2. 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 elect to choose somewhat different versions, within the limits of the support of Trac. I haven't tried many alternative configurations. I know the versions I used here work cleanly. As a precautionary 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. == 2.1: SQLite (3.27 and 3.3.13 known to be ok) == (http://www.sqlite.org/download.html) This configure is straight-forward. You should be able to use the ./configure, make, make install method with impunity. {{{ ./configure make make install }}} == 2.2: 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 }}} == 2.3: !ClearSilver == (http://www.clearsilver.net/downloads/) === 2.3.1 !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 }}} === 2.3.2 !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. === 2.3.3 !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. There are two gotchas 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. 2. 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). ==== 2.3.3.1: 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", }}} ==== 2.3.3.2: Build and install the !ClearSilver libraries: ==== {{{ CFLAGS=-fPIC ./configure --with-python=/usr/bin/python CFLAGS=-fPIC make make install }}} == 2.4: Subversion (1.2.3 or 1.3.2; 1.4.x won't build) == (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: === 2.4.1: Create `/etc/apache2/httpd2-prefork.conf` and add a bogus !LoadModule directive: === {{{ ###Subversion/apxs install script workaround: LoadModule foo /bar.so }}} === 2.4.2: 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 }}} === 2.4.3: 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 }}} === 2.4.4: 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 }}} == 2.5: 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 }}} = 3. Additional Setup = As much as I'd like to say that's all there is, there are still a couple of steps to actually getting your installation up. You should refer to the installation guide (http://projects.edgewall.com/trac/wiki/TracInstall) first, but I'll describe my somewhat-overlapping process for finishing the setup of the Apache/mod_python installation. == 3.1: 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 }}} == 3.2: 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. == 3.3: 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. I suspect most installations will be similar. === 3.3.1: 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. === 3.3.2: 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. === 3.3.3: 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`, typically. You can add the first user with: {{{ htpasswd2 -c /svn/conf/someprojectusers }}} === 3.3.4: Add a configuration file for your project to `/etc/apache2/my_conf`. === This is where you actually set up your Subversion and Trac access. Everybody likes their project directories set up differently, depending on where the server is hosted, if virtual hosts are available, and so on, but 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 }}} === 3.3.5: Make sure that your Apache user has access to the repository and Trac environment. === On my installation, `wwwrun` is the Apache user, so I used `chown -R wwwrun:root /var/svn /var/trac` to get things rolling. You may have some additional permissions to implement on top of these, but they should get you started. === 3.3.6: 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. === 3.3.7: Cross your fingers and try it out. === If you follow this guide, you should at least get a working installation running. Once you've got that, customization for virtual hosts, different authentication, and so on should follow typical Trac behavior, where you are more likely to find support if you get stumped. -------- See also: [wiki:TracOnSuSE TracOnSuSE], TracInstall