让Linux下的tomcat自启动
Redhat 9.0、RHEL AS 3、RHEL AS 4
下载以下文件至目录:/usr/local/src
j2sdk-1_4_2_08-linux-i586.bin
jakarta-tomcat-4.1.31.tar.gz
#cd /usr/local/src
#chmod +x j2sdk-1_4_2_08-linux-i586.bin
#./j2sdk-1_4_2_08-linux-i586.bin
生成目录j2sdk1.4.2_08
#tar -zxvf jakarta-tomcat-4.1.31.tar.gz
生成目录jakarta-tomcat-4.1.31
#mv j2sdk1.4.2_08 /usr/local
#mv jakarta-tomcat-4.1.31 /usr/local
#cd /usr/local
建立符号链接
#ln -s jakarta-tomcat-4.1.31/ tomcat
#ln -s j2sdk1.4.2_08/ java
#cd tomct/bin
#more catalina.sh
编辑TOMCAT的启动脚本:
#vi +2 catalina.sh
在第二行加入以下几行内容:
#
# chkconfig: 2345 63 37
# description: Tomcat server init script
#
# set entironment variable JAVA_HOME and CATALINA_HOME
JAVA_HOME=/usr/local/java
CATALINA_HOME=/usr/local/tomcat
#
然后保存退出vi。
#cp catalina.sh /etc/rc.d/init.d/tomcat
#chkconfig --add tomcat
#chkconfig --list tomcat
tomcat 0:off 1:off 2:on 3:on 4:on 5:on 6:off
启动tomcat
#service tomcat start
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JAVA_HOME: /usr/local/java
测试tomcat是否启动
#netstat -an|grep 8080
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN
停止tomcat
#service tomcat stop
注:
Tomcat 5.5也适用
摘自:http://blog.csdn.net/lonelycloud/archive/2005/11/21/534034.aspx