日期:2014-05-17  浏览次数:21087 次

(四)tomcat安装并整合apache

1 下载

?? 下载地址:http://labs.renren.com/apache-mirror/tomcat/tomcat-6/v6.0.35/bin/apache-tomcat-6.0.35.tar.gz

?

2.安装

?? 解压

[root@localhost bluesea]# cp apache-tomcat-6.0.35.tar.gz /usr/local/
[root@localhost bluesea]# cd /usr/local/
[root@localhost local]# tar -zxvf apache-tomcat-6.0.35.tar.gz 

? 配置

[root@localhost local]# vi /etc/profile

??? 修改并退出(:wq)

??? 添加 export CATALINA_HOME=/usr/local/apache-tomcat-6.0.35

?

3添加tomcat到系统服务

[root@localhost init.d]# cd /etc/init.d/
[root@localhost init.d]# touch tomcat
[root@localhost init.d]# chmod a+x tomcat
[root@localhost init.d]# vi tomcat

??? 添加如下内容

#!/bin/sh

#chkconfig:345 61 61
#description:apache-tomcat-6.0.29
##############################################

#Startup script for Tomcat on Linux

#filename tomcat.sh
#Make sure the java and the tomcat installation path has been added to the PATH


JAVA_HOME=/usr/java/jdk1.6.0_30
CATALINA_HOME=/usr/local/apache-tomcat-6.0.35
export JAVA_HOME

export CATALINA_HOME

###############################################
start_tomcat=$CATALINA_HOME/bin/startup.sh

stop_tomcat=$CATALINA_HOME/bin/shutdown.sh

start() {

        echo -n "Starting tomcat: "

        ${start_tomcat}

        echo "tomcat start ok."
}

stop() {
        echo -n "Shutting down tomcat: "

        ${stop_tomcat}

        echo "tomcat stop ok."

}



# See how we were called



case "$1" in

  start)

        start

        ;;

  stop)

        stop

        ;;

  restart)

        stop

        sleep 10

        start

        ;;

  *)

        echo "Usage: $0 {start|stop|restart}"

esac



exit 0