in Internet Services, Linux

installing Tomcat 5.5 on SUSE Linux Enterprise Server 9

It was busy in June and July over at $WORK, so I didn’t get a chance to write any entries here. Some of the work I’ve been doing include turning off all legacy servers (among the legacy servers are only 2 FreeBSD boxes and a handful of HP/UX dinosaurs, but the rest of the production environment is SUSE Linux Enterprise), shepherding the BlueArc storage upgrade through (a huge pallet containing disks, controllers, disk shelves, and a replacement Fibre Channel switch arrived last week), and, of course, planning our upgrade to a modern Apache/Java environment. This will consist of Apache 2.x with a Tomcat 5.5 back end — a far cry from our current Apache 1.x and Tomcat 3.x setup.

One of the major challenges is getting Tomcat 5.5 running on SLES 9 under a Java 1.5.x virtual machine. Actually, it’s not so much the “running” part — I’m sure that since it’s Java, it would just run if I did the old tar zxvf tomcat-5.5.tar.gz && make && make install dance. But we’re after sensible package management here, and that means trying to make SLES 9 behave the standard way. SLES 9 is missing a lot of the “standard” tools that folks use to manage Java apps; it has no jpackage-utils built-in, it doesn’t use the alternatives system, and it can’t talk to Yum repositories out of the box. The work instructions I developed here hack up the base OS a bit to bolt on these tools, but ultimately do the job.

The long-term solution, of course, is to move to either SLES 10 or RedHat Enterprise Linux 5. SLES 10 ships Tomcat 5.0.x out of the box (just like SLES 9) so on the surface, it doesn’t seem like much of an improvement. But they have moved to the alternatives system; jpackage-utils is bundled with the base system, and ZMD (for what it’s worth) will talk to Yum repositories. (Of course, that’s in theory: in practice, as with many Novell tools, it’s broken.) RHEL 5 seems like the obvious answer, since it ships Tomcat 5.5 right out of the box.

Anyway, that’s a bit of a digression. Here are my directions for getting Tomcat 5.5 installed and properly package-managed on SLES 9 with JPackage.

As I mentioned, we are going to use JPackage 1.7 to manage Tomcat 5.5 and its Java library dependencies. JPackage provides a Yum repository for its packages, so first we have to get Yum working.

Install jpackage-utils

To bootstrap the process we need to install jpackage-utils manually. Grab and install it from here.

Install the “alternatives” subsystem

The “alternatives” framework provides a mechanism for a system administrator to choose among (as the name suggests) alternatives for a particular system function. For example, the alternatives framework is frequently used to manage mail servers – to choose between Postfix, sendmail, qmail, etc. In our case, we want to use it to manage Java alternatives (having 2 JVMs on the same system – JVM 1.4.2 for the legacy CBC.ca applications and JVM 1.5.x for Tomcat 5.5 applications). This will supersede the setJava/getJava tools bundled in aaa_base.

Since SLES9 does not provide the alternatives framework (via the update-alternatives) package, we need to install it from JPackage 1.6.

Install JDK 1.5 the “JPackage Way”

Get the latest nosrc RPM for the 1.5.x JVM from the JPackage site and rebuild it once you have retrieved the commercial sources from Sun. For more information on doing this step, please see this page.

Once built, the java-1.5.0-sun and java-1.5.0-sun-devel packages should be installed on the target system.

Build and Install Yum

Download Yum 2.0.8 (a version of Yum I found to be compatible with SLES 9 without too many external dependencies). You have to hack the specfile to remove the dependency on /sbin/service. Then rebuild the Yum RPM.

In order to build Yum you will need the following packages installed from SLES9 media: python, rpm-python and python-xml.

Prior to installing Yum you need to upgrade the version of the libxml2 parser, because the version which comes with SLES9 is too old and does not bundle libxml2 Python bindings required for Yum. Download the latest ones provided by the XML subproject of the OpenSuSE build service here and install libxml2 (upgrading from the one supplied with SLES9) and libxml2-python

Now you can install Yum.

Configure Yum repository for JPackage

Since we are only using Yum to manage JPackage, your /etc/yum.conf can be quite minimal. I have the following:

[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=sles-release
tolerant=1
exactarch=1

[jpackage17-suse90]
name=JPackage 1.7 for SuSE Linux Enterprise Server 9
baseurl=http://mirrors.dotsrc.org/jpackage/1.7/suse-es-9.0/free/
gpgcheck=1

[jpackage17-generic]
name=JPackage 1.7, generic
baseurl=http://mirrors.dotsrc.org/jpackage/1.7/generic/free/
gpgcheck=1

Import JPackage GPG Key

Look here for directions.

Refresh JPackage Repository

At this point you should be able to refresh the local Yum catalogs as follows:

$ sudo yum update

Install Tomcat 5.5

If that works, you can go ahead and install Tomcat 5.5 with the following:

$ sudo yum install tomcat5

This will install all of the Tomcat dependencies as well.