Tomcat
We need a servlet container to deploy the servlet of Open-Exchange. In this install we use Tomcat for this. Of cource any other J2EE application server could be used for this.
Install
To install tomcat 5:
cd /usr/local wget <Get lastest version from: http://jakarta.apache.org/site/downloads/downloads_tomcat-5.cgi> tar -xzvf jakarta-tomcat-5.5.9.tar.gz ln -s jakarta-tomcat-5.5.9 tomcat
Note: tomcat5 is currently in debian experimental, but this is really not for production use.
Config
Put the following script in /etc/init.d/tomcat5
#! /bin/sh -e
#
# /etc/init.d/tomcat5 -- startup script for the Tomcat 5.0 servlet engine
#
# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
# Modified for Debian GNU/Linux by Ian Murdock <imurdock@gnu.ai.mit.edu>.
# Modified for Tomcat by Stefan Gybas <sgybas@debian.org>.
# Modified for JMX console properties.
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=catalina.sh
DESC="Tomcat 5"
CATALINA_HOME=/usr/local/tomcat
DAEMON=$CATALINA_HOME/bin/$NAME
TOMCAT_USER="root"
JAVA_HOME="/usr/lib/j2sdk1.5-sun/"
CATALINA_OPTS="";
CATALINA_OPTS_START="-Xms512m -Xmx512m -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9930 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.j mxremote.ssl=false";
CATALINA_OPTS_STOP="";
test -f $DAEMON || exit 0
export JAVA_HOME
PIDFILE="/var/run/$NAME.pid"
LOGDIR="$CATALINA_HOME/logs"
WEBAPPDIR="$CATALINA_HOME/webapps"
case "$1" in
start)
echo -n "Starting $DESC using Java from $JAVA_HOME: "
CATALINA_OPTS=$CATALINA_OPTS_START;
export CATALINA_OPTS;
su -p -s /bin/sh $TOMCAT_USER -c "\"$DAEMON\" start" \
>>"$LOGDIR/catalina.out" 2>&1
echo "$NAME."
;;
stop)
CATALINA_OPTS=$CATALINA_OPTS_END;
export CATALINA_OPTS;
echo -n "Stopping $DESC: "
su -p $TOMCAT_USER -c "\"$DAEMON\" stop" >/dev/null 2>&1 || true
echo "$NAME."
;;
restart|force-reload)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: /etc/init.d/tomcat5 {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
To automaticly start tomcat when starting the machine do:
cd /etc/init.d/ update-rc.d tomcat5 defaults
Add virtual hosting for tomcat; edit /usr/local/tomcat/conf/server.xml
<Server port="8005" shutdown="SHUTDOWN">
<GlobalNamingResources>
<!-- Used by Manager webapp -->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
<Service name="Catalina">
<!-- <Connector port="8080" /> -->
<!-- This is here for compatibility only, not required -->
<Connector port="8009" protocol="AJP/1.3" />
<Engine name="Catalina" defaultHost="localhost">
<!-- <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> -->
<Host name="ox.matrix.home" appBase="webapps/ox.matrix.home">
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs"
prefix="os.matrix.home-"
suffix=".log"
timestamp="true"/>
</Host>
<!-- we can add here other virtual hosts, also make a ROOT.xml for earch virtual hosts -->
</Engine>
</Service>
</Server>
Also add the following file: /usr/local/tomcat/conf/Catalina/ox.matrix.home/ROOT.xml (first create the directory)
<?xml version='1.0' encoding='utf-8'?> <Context displayName="ox.matrix.home" docBase="" path="" workDir="work/Catalina/ox.matrix.home/_"> </Context>
Create the webapp for OX:
mkdir -p /usr/local/tomcat/webapps/ox.matrix.home/lib/ mkdir /usr/local/tomcat/webapps/ox.matrix.home/classes/ cp /usr/local/open-xchange/share/servlets/* /usr/local/tomcat/webapps/ox.matrix.home/classes/ cp /usr/local/open-xchange/lib/*.jar /usr/local/tomcat/webapps/ox.matrix.home/lib/
Create a web.xml in /usr/local/tomcat/webapps/ox.matrix.home/ like:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Servlet OpenXchange</display-name>
<description>Servlet OpenXchange 0.7.1</description>
<servlet>
<servlet-name>intranet</servlet-name>
<servlet-class>intranet</servlet-class>
</servlet>
<servlet>
<servlet-name>webmail</servlet-name>
<servlet-class>webmail</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>intranet</servlet-name>
<url-pattern>/servlet/intranet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>webmail</servlet-name>
<url-pattern>/servlet/webmail</url-pattern>
</servlet-mapping>
</web-app>
We should now have a working tomcat5 webserver.
Working? Go ahead to the next part. ->../oxconfig
Changelog of this document
-
2005-08-09: Document created.
-
2005-08-10: updated paths and added next part link.
-
2005-08-12: changed startup script so it has start and stop properties.
-
2005-08-16: added virtual hosting for tomcat and OX servlets.
