1,在/usr/local/下部署两个tomcat7。
2,修改/etc/profile文件,加入下面内容
vi /etc/profile
export JAVA_HOME=/usr/java/jdk8
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=$JAVA_HOME/jre/lib/ext:$JAVA_HOME/lib/tools.jar
export PATH JAVA_HOME CLASSPATH
####tomcat7
TOMCAT_HOME=/usr/local/tomcat/
CATALINA_HOME=/usr/local/tomcat/
CATLINA_BASE=/usr/local/tomcat/
export TOMCAT_HOME CATALINA_HOME CATALINA_BASH
####tomcat8
TOMCAT_HOME_1=/usr/local/tomcat1/
CATALINA_HOME_1=/usr/local/tomcat1/
CATLINA_BASE_1=/usr/local/tomcat1/
export TOMCAT_HOME_1 CATALINA_HOME_1 CATALINA_BASH_1
TOMCAT_HOME=/usr/local/tomcat
export TOMCAT_HOME
TOMCAT_HOME_1=/usr/local/tomcat1
export TOMCAT_HOME_1
3,修改tomcat配置文件 ,
tomcat保持不变;
修改tomcat1配置如下:
在/usr/local/tomcat8/bin下,修改startup.sh 和 shutdown.sh 两个文件,在文件#!/bin/sh下面入如下:
export JAVA_HOME=/usr/java/jdk1.8.0_92/
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib:$JAVA_HOME/bin
export CATALINA_HOME=$CATALINA_HOME_1
export CATLINA_BASE=$CATLINA_BASE_1
4,修改tomcat1/conf/server.xml 文件,
<Server port="8006" shutdown="SHUTDOWN"> #将原8005改为8006
<Connector port="8083" maxHttpHeaderSize="8192" #将8080改为8083
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="120000" disableUploadTimeout="true" URIEncoding="UTF-8" />
<Connector port="8010" protocol="AJP/1.3" redirectPort="8443" /> ##将8009改为8010
<Engine name="Test" defaultHost="Test">