借鉴网址: http://wbande.blog.163.com/blog/static/303812572010511101812972/
JDK
vi /etc/profile
JAVA_HOME=/usr/local/jdk1.6.0_23
CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
PATH=$PATH:$JAVA_HOME/bin
JRE_HOME=$JAVA_HOME/jre
export JAVA_HOME
export PATH
export CLASSPATH
原有的为:tomcat7,新增加的为tomcat71
1 在/etc/profile中添加以下粗体的配置
#原有的tocmat配置
#tomcat7
TOMCAT_HOME=/usr/local/tomcatx/tomcat7
CATALINA_HOME=/usr/local/tomcatx/tomcat7
CATALINA_BASE=/usr/local/tomcatx/tocat7
export TOMCAT_HOME CATALINA_HOME CATALINA_BASE
#添加的tocmat配置,可照此样添加多个tomcat
#tomcat71
TOMCAT_71_HOME=/usr/local/tomcatx/tomcat71
CATALINA_71_HOME=/usr/local/tomcatx/tomcat71
CATALINA_71_BASE=/usr/local/tomcatx/tocat71
export TOMCAT_71_HOME CATALINA_71_HOME CATALINA_71_BASE
2 修改tomcat71的bin/shutdown.sh,在exec "$PRGDIR"/"$EXECUTABLE" stop "$@"这行前边添加如下配置:
export JAVA_HOME=/usr/local/jdk1.6.0_23
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=$JAVA_HOME/lib
export CATALINA_HOME=$CATALINA_71_HOME
export CATALINA_BASE=$CATALINA_71_BASE
3 修改tomcat71的bin/startup.sh,在exec "$PRGDIR"/"$EXECUTABLE" stop "$@"这行前边添加如下配置:
export JAVA_HOME=/usr/local/jdk1.6.0_23
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=$JAVA_HOME/lib
export CATALINA_HOME=$CATALINA_71_HOME
export CATALINA_BASE=$CATALINA_71_BASE
4 修改tocmat6.0-2的conf/server.xml,更改端口
-----------------------------tocmat6.0-2的server.xml配置如下----------------
<?xml version='1.0' encoding='utf-8'?>
<Server port="9005 " shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<Listener className="org.apache.catalina.core.JasperListener" />
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<GlobalNamingResources>
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
<Service name="Catalina">
<Connector port="9080 " protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8" maxHttpHeaderSize="8192" maxThreads="1000" enableLookups="false" compression="on" compressionMinSize="2048" compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain" disableUploadTimeout="true" useBodyEncodingForURI="true" />
<Connector port="9009 " protocol="AJP/1.3" connectionTimeout="20000"
redirectPort="8443" />
<Engine name="Catalina" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
</Host>
</Engine>
</Service>
</Server>