By Joel Barnum, Descriptor Systems. Last updated: 2010-7-28.
In this article, you will learn how to install the Apache Tomcat Web container and the Apache Portable Runtime on a Debian Lenny server.
Blatant, shameless plug: If you are not familiar with Tomcat and Java, I recommend that you get some training from Descriptor Systems. You can find more information at www.descriptor.com. Thanks!
Tomcat 6 itself only requires a Java Runtime Environment (JRE), not a full Java Development Kit, but some of the other steps in this HOWTO require the JDK.
aptitude update aptitude install sun-java6-jdk
While you can install Tomcat with apt-get or aptitude, I prefer to install it manually (just because).
cd /opt tar zxvf /temp/tomcat-6/v6.0.29/bin/apache-tomcat-6.0.29.tar.gz
groupadd tomcat useradd -g tomcat -s /usr/sbin/nologin -m -d /home/tomcat tomcat chown -R tomcat.tomcat /opt/apache-tomcat-6.0.29
su - -s /bin/sh tomcat
cd /opt/apache-tomcat-6.0.29 bin/catalina.sh start
bin/catalina.sh stop rm logs/*
According to the Tomcat docs, the Apache Portable Runtime (APR) provides performance benefits, especially if your Web applications use SSL or serve large static files. Unfortunately, the documentation for installing the APR is marginal, at best (thus the raison d'tre for this HOWTO).
Tomcat can use the APR only if the APR itself is installed and if Tomcat's so-called JNI native wrappers are present. You will set up and configure both of those here.
aptitude install libapr1 libaprutil1 libapr1-dev libssl-dev make
cd /opt/apache-tomcat-6.0.29/temp tar zxvf ../bin/tomcat-native.tar.gz
cd tomcat-native*/jni/native ./configure --with-apr=/usr/bin/apr-1-configure make make install
ln -s /usr/local/apr/lib/libtcnative-1.so /usr/lib/libtcnative-1.so
INFO: Loaded APR based Apache Tomcat Native Library 1.1.120