linux下多Tomcat部署
步骤1:安装完tomcat后,直接在原目录下复制一份,分别重命名为tomcat1,tomcat2
步骤2:到根目录 /etc/profile中添加如下部署
export JAVA_HOME=/usr/local/jdk/jdk1.8.0_211
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
##上边不变,新增如下
#tomcat1
export CATALINA_HOME=/usr/local/tomcat/tomcat1
export CATALINA_BASE=/usr/local/tomcat/tomcat1
export TOMCAT_HOME=/usr/local/tomcat/tomcat1
#tomcat2
export CATALINA_HOME2=/usr/local/tomcat/tomcat2
export CATALINA_BASE2=/usr/local/tomcat/tomcat2
export TOMCAT_HOME2=/usr/local/tomcat/tomcat2
步骤3:修改tomcat2的conf下server.xml中的端口,不重复就行
<Server port="8006" shutdown="SHUTDOWN">
...
<Connector port="8081" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8444" />
<Connector port="8010" protocol="AJP/1.3" redirectPort="8444" />
...
这些端口和tomcat1的配置不冲突就行。
步骤4:修改tomcat2的startup.sh
# Check that target executable exists
if $os400; then
# -x will Only work on the os400 if the files are:
# 1. owned by the user
# 2. owned by the PRIMARY group of the user
# this will not work if the user belongs in secondary groups
eval
else
if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
echo "Cannot find $PRGDIR/$EXECUTABLE"
echo "The file is absent or does not have execute permission"
echo "This file is needed to run this program"
exit 1
fi
fi
#添加这两行
export CATALINA_HOME=$CATALINA_HOME2
export CATALINA_BASE=$CATALINA_BASE2
exec "$PRGDIR"/"$EXECUTABLE" start "$@"
ok,到此,tomcat2就可以正常启动了,不影响tomcat1的运行
本博客所有文章除特别声明外,均采用 CC BY-SA 3.0协议 。转载请注明出处!