- Javaを入れておく
- ダウンロードと解凍
# cd /usr/local
# wget http://ftp.kddilabs.jp/path/to/apache-tomcat-6.0.16.tar.gz
# tar -xzvf apache-tomcat-6.0.16.tar.gz
# ln -s apache-tomcat-6.0.16.tar.gz tomcat
- 起動スクリプト(/etc/init.d/tomcat)の作成
#!/bin/bash
#
# Startup script for the tomcat
#
# chkconfig: 345 80 15
# description: Tomcat is a Servlet+JSP Engine.
# Source function library.
. /etc/rc.d/init.d/functions
start(){
if [ -z $(/sbin/pidof java) ]; then
echo "Starting tomcat"
/usr/local/tomcat/bin/startup.sh
touch /var/lock/subsys/tomcat
else
echo "tomcat allready running"
fi
}
stop(){
if [ ! -z $(/sbin/pidof java) ]; then
echo "Shutting down tomcat"
/usr/local/tomcat/bin/shutdown.sh
until [ -z $(/sbin/pidof java) ]; do :; done
rm -f /var/lock/subsys/tomcat
else
echo "tomcat not running"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
/usr/local/tomcat/bin/catalina.sh version
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
esac
exit 0
- 起動&自動起動設定
# /etc/init.d/tomcat start
# chkconfig --add tomcat
# chkconfig tomcat on ← Tomcat自動起動設定
# chkconfig --list tomcat
- /etc/httpd/conf.d/proxy_ajp.confに次を追加(※Tomcat5と異なるので注意)
ProxyPass /tomcat/ ajp://localhost:8009/
ProxyPass /examples/ ajp://localhost:8009/examples/
- httpdの再起動
# /etc/init.d/httpd restart