Linux下部署多个tomcat

需要改三个地方

  • 环境变量
  • tomcat下的catalina.sh文件
  • conf目录下的server.xml里要改三个地方

环境变量

vi /etc/profile

配置tomcat:

# tomcat 
export CATALINA_BASE=/usr/local/tomcat
export CATALINA_HOME=$CATALINA_BASE
export TOMCAT_HOME=$CATALINA_BASE
# tomcat1
export CATALINA_1_BASE=/usr/local/software/tomcat/tomcat1
export CATALINA_1_HOME=/usr/local/software/tomcat/tomcat1
export TOMCAT_1_HOME=/usr/local/software/tomcat/tomcat1
# tomcat2
export CATALINA_2_BASE=/usr/local/software/tomcat/tomcat2
export CATALINA_2_HOME=/usr/local/software/tomcat/tomcat2
export TOMCAT_2_HOME=/usr/local/software/tomcat/tomcat2

修改catalina.sh文件

/usr/local/tomcat下的tomcat保持默认
修改tomcat1的catalina.sh文件:

vi catalina.sh +118

命令模式下按小写o(在下一行插入),修改成:

# OS specific support.  $var _must_ be set to either true or false.
export CATALINA_BASE=$CATALINA_1_BASE
export CATALINA_HOME=$CATALINA_1_HOME

然后修改tomcat2的catalina.sh文件,如法炮制后:

# OS specific support.  $var _must_ be set to either true or false.
export CATALINA_BASE=$CATALINA_2_BASE
export CATALINA_HOME=$CATALINA_2_HOME

修改server.xml文件

/usr/local/tomcat的tomcat的保持默认。
修改tomcat1/conf下的server.xml文件:

vi server.xml +22

把端口8005改成8006:


定位到69行:69G
把端口8080改成8081:


定位到116行:116G
把端口8009改成8010:


OK,tomcat1的改完了。tomcat2也是改这三个端口,只要保持不冲突就好。

你可能感兴趣的:(linux)