1.参考前文安装jdk、第一个tomcat

2.安装第二个tomcat后,修改/etc/profile

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

  vi /etc/profile

  #tomcat1
  export CATALINA_BASE=/opt/tomcat1
  export CATALINA_HOME=/opt/tomcat1
  export TOMCAT_HOME=/opt/tomcat1

  #tomcat2
  export CATALINA_BASE2=/opt/tomcat2
  export CATALINA_HOME2=/opt/tomcat2
  export TOMCAT_HOME2=/opt/tomcat2

  source /etc/profile

3.修改server.xml文件

  <Server port="8006" shutdown="SHUTDOWN">

  <Connector port="8081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />

  <Connector port="8010" protocol="AJP/1.3" redirectPort="8443" />

4.修改catalina.sh

  在 # OS specific support.  $var _must_ be set to either true or false. 后添加下列两行代码

  export CATALINA_BASE=$CATALINA_BASE2

  export CATALINA_HOME=$CATALINA_HOME2

5.启动tomcat

6.多台tomcat以此类推

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄