linux下同时安装多个tomcat实例

up8773 9年前

来自: http://my.oschina.net/u/2250952/blog/607465


环境:rhel5.5   64bit

所需要的包:

Jdk-6u21-linux-x64-rpm.bin

Apache-tomcat-5.5.33.tar.gz

安装步骤

  1. 1.       chmod +x Jdk-6u21-linux-x64-rpm.bin

  2. 2.       ./jdk-6u21-linux-x64-rpm.bin

  3. 3.       ln –s /usr/java/jdk 1.6.0_21  /usr/jdk

  4. 4.       tar zxvf apache-tomcat-5.5.33.tar.gz  -C /usr/local

  5. 5.       ln –s /usr/local/apache-tomcat-5.5.33 /usr/local/tomcat

  6. 6.       cp –rp /usr/local/{tomcat,tomcat2}

  7. 7.       vim /etc/profile

添加如下内如:

JAVA_HOME=/usr/jdk/

CLASSPATH=.:$JAVA_HOME/lib/tools.jar:/lib.dt.jar

PATH=$JAVA_HOME/bin:$PATH

export JAVA_HOME CLASSPATH PATH

CATALINA_BASE=/usr/local/tomcat

CATALINA_HOME=/usr/local/tomcat

export CATALINA_BASE CATALINA_HOME

CATALINA_2_BASE=/usr/local/tomcat2

CATALINA_2_HOME=/usr/local/tomcat2

export CATALINA_2_BASE CATALINA_2_HOME

TOMCAT_HOME=/usr/local/tomcat

export TOMCAT_HOME

TOMCAT_2_HOME=/usr/local/tomcat2

export TOMCAT_2_HOME

  1. 8.       cd  /usr/local/tomcat2/bin

  2. 9.       vim startup.sh

添加如下内容:

export JAVA_HOME=/usr/jdk

export PATH=$PATH:$JAVA_HOME/bin

export CLASSPATH=$JAVA_HOME/lib

export CATALINA_HOME=$CATALINA_2_HOME

export CATALINA_BASE=$CATALINA_2_BASE

(加在最后一行exec的前面)

  1. 10.   vim shutdown.sh

添加如下内容

export JAVA_HOME=/usr/jdk

export PATH=$PATH:$JAVA_HOME/bin

export CLASSPATH=$JAVA_HOME/lib

export CATALINA_HOME=$CATALINA_2_HOME

export CATALINA_BASE=$CATALINA_2_BASE

(加在最后一行exec的前面)

  1. 11.   cd /usr/local/tomcat2/conf

  2. 12.   vim server.xml

更换如下端口

8009à9009 apache监听端口

8080à9080 tomcat监听端口

8443à9443 SSL的连接端口

8005à9005 用于停止tomcat的端口