安裝了Tomcat 5.5,很簡單,將下載下來的安裝文件包解壓,放入相應的目錄中,然後在Linux環境中設置相應的如:JAVA_HOME、CATALINA_HOME等環境變量後,在Tomcat的bin目錄下執行./catalina.sh run就能在終端方式上啟動tomcat的服務勒。如果需要將tomcat加入自啟動隊列中,則需要進行如下的操作:
以root用戶登錄系統:
cd /etc/rc.d/init.d/
vi tomcat
文件內容參考如下:
#!/bin/sh
#
# tomcat: Start/Stop/Restart tomcat
#
# chkconfig: 2345 80 20
# description: Tomcat is a Java Servlet Container
#
#
# match these values to your environment:
export CATALINA_BASE=/usr/local/tomcat
export CATALINA_HOME=/usr/local/tomcat
export CATALINA_TMPDIR=/usr/local/tomcat/temp
export JRE_HOME=/usr/java/jdk15
# Source function library.
. /etc/rc.d/init.d/functions
TOMCAT=/usr/local/tomcat
start() {
echo -n $"Starting Tomcat: "
$TOMCAT/bin/catalina.sh start
}
stop() {
echo -n $"Stopping Tomcat: "
$TOMCAT/bin/catalina.sh stop
}
# See how we were called.
case "{GetProperty(Content)}" in
start)
start
;;
stop)
stop
;;
status)
;;
status)
;;
restart)
stop
start
;;
*)
echo $"Usage: {GetProperty(Content)} {start|stop|restart}"
;;
esac
exit $RETVAL
把 tomcat 修改為可運行的文件,命令參考如下:
chmod a+x tomcat
使用chkconfig命令把 tomcat 命令加入到系統啟動隊列中:
chkconfig --add tomcat
查看apachectl的狀態:
chkconfig --list tomcat
好了,全部完成,很簡單的紀錄,希望能幫助你,也讓我自己記住