Installation
Platform is 'workstation' version of Red Hat 8 sans any
pre-installed rich desktop, graphics, Apache or Tomcat packages.
See johnturner.com
for an introduction to the process of setting up Tomcat as an Apache module.
The following notes clarify this process further.
It seems any version of apache 2.0.43 onward will
work with 1.2.2 mod_jk.so binary. Note, RH80 ships with 2.0.40 which is
evil with regard to pre-built mod_jk.so binaries.
Building Apache from scratch means the service httpd start|stop tools
will need to be hand constructed before they can be used with chkconfig.
The Host container portion of server.xml is the that which starts with
<HOST ...>
For best results use a raw IP address for ServerName
After adding Include .../auto/mod_jk.conf to end of httpd.conf, create
/usr/local/tomcat/conf/auto directory if it is not already present. Otherwise
Apache with complain when apachectl is invoked.
Apache CHKCONFIG
# diff httpd httpd.std
10c10
< # config: /usr/local/apache2/conf/httpd.conf
---
> # config: /etc/httpd/conf/httpd.conf
24,25c24,25
< apachectl=/usr/local/apache2/bin/apachectl
< httpd=/usr/local/apache2/bin/httpd
---
> apachectl=/usr/sbin/apachectl
> httpd=/usr/sbin/httpd
28a29,44
> # check for 1.3 configuration
> check13 () {
> CONFFILE=/etc/httpd/conf/httpd.conf
> GONE="(ServerType|BindAddress|Port|AddModule|ClearModuleList|"
> GONE="${GONE}AgentLog|RefererLog|RefererIgnore|FancyIndexing|"
> GONE="${GONE}AccessConfig|ResourceConfig)"
> if grep -Eiq "^[[:space:]]*($GONE)" $CONFFILE; then
> echo
> echo 1>&2 " Apache 1.3 configuration directives found"
> echo 1>&2 " please read /usr/share/doc/httpd-2.0.40/migration.html"
> failure "Apache 1.3 config directives test"
> echo
> exit 1
> fi
> }
>
34a51
> check13 || exit 1
49a67
> check13 || exit 1
# ls -l httpd
-rwxr-xr-x 1 root root 1847 Apr 18 17:30 httpd
# chkconfig --del httpd
# chkconfig --add httpd
# chkconfig --level 2345 httpd on
# chkconfig --list httpd
# service httpd
...
Tomcat CHKCONFIG
# chkconfig --del tomcatd
# chkconfig --add tomcatd
# chkconfig --level 345 tomcatd on
# chkconfig --list tomcatd
# chmod +x /usr/local/tomcat/bin/*.sh
# service httpd
...
# cat /etc/rc.d/init.d/tomcatd
#!/bin/bash
#
# Startup script for Jakarta Tomcat
#
# chkconfig: 345 84 16
# description: Jakarta Tomcat Java Servlet/JSP Container
TOMCAT_HOME=/usr/local/tomcat
TOMCAT_START=/usr/local/tomcat/bin/startup.sh
TOMCAT_STOP=/usr/local/tomcat/bin/shutdown.sh
#Necessary environment variables
export CATALINA_HOME=/usr/local/tomcat
export JAVA_HOME=/usr/java/j2sdk1.4.1_02
export LD_KERNEL_ASSUME="2.2.5"
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
#Check for tomcat script
if [ ! -f $TOMCAT_HOME/bin/catalina.sh ]
then
echo "Tomcat not available..."
exit
fi
start() {
echo -n "Starting Tomcat: "
daemon $TOMCAT_START
echo
touch /var/lock/subsys/tomcatd
# We may need to sleep here so it will be up for apache
# sleep 5
#Instead should check to see if apache is up by looking for http.pid
}
stop() {
echo -n $"Shutting down Tomcat: "
daemon $TOMCAT_STOP
rm -f /var/lock/subsys/tomcatd.pid
echo
}
status() {
ps ax --width=1000 | grep "[o]rg.apache.catalina.startup.Bootstrap start" \
| awk '{printf $1 " "}' | wc | awk '{print $2}' > /tmp/tomcat_process_count.txt
read line < /tmp/tomcat_process_count.txt
if [ $line -gt 0 ]; then
echo -n "tomcatd ( pid "
ps ax --width=1000 | grep "[o]rg.apache.catalina.startup.Bootstrap start" \
| awk '{printf $1 " "}'
echo -n ") is running..."
else
echo -n "Tomcat is stopped"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 3
start
;;
status)
status
;;
*)
echo "Usage: tomcatd {start|stop|restart|status}"
exit 1
esac
|
|