Install TomCat 5.5.17 with Apache Portable Runtime 1.2.7 on Linux
Tomcat can use the Apache Portable Runtime to provide superior scalability, performance, and better integration with native server technologies. The Apache Portable Runtime is a highly portable library that is at the heart of Apache HTTP Server 2.x. APR has many uses, including access to advanced IO functionality (such as sendfile, epoll and OpenSSL),OS level functionality (random number generation, system status, etc), and native process handling
(shared memory, NT pipes and Unix sockets).View for details:
http://tomcat.apache.org/tomcat-5.5-doc/apr.html
Install Apache Portable RunTime 1.2.7 and openssl-0.9.8b on the box (CentOS 4.2).
APR Source directory - /usr/local/src/apr-1.2.7
APR Target directory - /usr/local/apr
OPEN SSL Target directory - /usr/local/ssl
Account "tomcat" has the same .bash_profile as in [1].
Tomcat Server version 5.5.17 has been installed by "tomcat" as usual.
# su - tomcat
Compile $CATALINA_HOME/bin/jsvc :-
cd $CATALINA_HOME/bin
tar xvfz jsvc.tar.gz
cd jsvc-src
autoconf
./configure
make
cp jsvc ..
cd ..
Proceed with compiling libraries for APR:-
$ cd $CATALINA_HOME/bin/tomcat-native-1.1.3/jni/native
$ sh buildconf --with-apr=/usr/local/src/apr-1.2.7
$ ./configure --with-apr=/usr/local/apr --with-ssl=/usr/local/ssl
$ make
$ cd .libs
[tomcat@ServerCentOS4U2 .libs]$ pwd
/home/tomcat/apache-tomcat-5.5.17/bin/tomcat-native-1.1.3/jni/native/.libs
[tomcat@ServerCentOS4U2 .libs]$ ls -l
total 1572
-rw-r--r-- 1 tomcat users 937506 Aug 4 15:47 libtcnative-1.a
lrwxrwxrwx 1 tomcat users 19 Aug 4 15:47 libtcnative-1.la -> ../libtcnative-1.la
-rw-r--r-- 1 tomcat users 990 Aug 4 15:47 libtcnative-1.lai
lrwxrwxrwx 1 tomcat users 22 Aug 4 15:47 libtcnative-1.so -> libtcnative-1.so.0.1.3
lrwxrwxrwx 1 tomcat users 22 Aug 4 15:47 libtcnative-1.so.0 -> libtcnative-1.so.0.1.3
-rwxr-xr-x 1 tomcat users 657270 Aug 4 15:47 libtcnative-1.so.0.1.3
Create as root startup script /etc/init.d/TomCatJsvc:-
# Script to start TomCat 5.5.17 as daemon with version 1.1.3 "tc" native support
# library for Apache Portable Runtime 1.2.7
# Variable CATALINA_OPTS provides the path to "tc" native library
JAVA_HOME='/home/tomcat/jdk1.5.0_06'
CATALINA_HOME='/home/tomcat/apache-tomcat-5.5.17'
CLASSPATH=$CATALINA_HOME/bin/bootstrap.jar:$CATALINA_HOME/bin/commons-daemon.jar:$JAVA_HOME/lib/tools.jar
CATALINA_OPTS="$CATALINA_OPTS -Djava.library.path=/home/tomcat/apache-tomcat-5.5.17/bin/tomcat-native-1.1.3/jni/native/.libs"
TOMCAT_USER=tomcat
TMPDIR=/var/tmp
RC=0
case "$1" in
start)
$CATALINA_HOME/bin/jsvc -user $TOMCAT_USER -home $JAVA_HOME -Dcatalina.home=$CATALINA_HOME -Djava.io.tmpdir=$TMPDIR -Djava.awt.headless=true -outfile $CATALINA_HOME/logs/catalina.out -errfile $CATALINA_HOME/logs/catalina.err $CATALINA_OPTS -cp $CLASSPATH org.apache.catalina.startup.Bootstrap
RC=$?
[ $RC = 0 ] && touch /var/lock/subsys/tomcat
;;
stop)
PID=`cat /var/run/jsvc.pid`
kill $PID
RC=$?
[ $RC = 0 ] && rm -f /var/lock/subsys/tomcat /var/run/jsvc.pid
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
exit $RC
Enable Open SSL on TomCat 5.5.17 :-
# su - tomcat
$ cd $CATALINA_HOME/conf/
$ /usr/local/ssl/bin/openssl genrsa -des3 -out tomcatkey.pem 2048
$ /usr/local/ssl/bin/openssl req -new -x509 -key tomcatkey.pem -out tomcatcert.pem -days 1095
Changes have been done to $CATALINA_HOME/conf/server.xml:
To start server:-
# /etc/init.d/TomCatJsvc start