Linux configuration deploy multiple tomcat

Configure the / etc/profile environment variable. Change to your tomcat path.

vim /etc/profile
##########1 tomcat###########
CATALINA_BASE=/usr/local/tomcat1
CATALINA_HOME=/usr/local/tomcat1
TOMCAT_HOME=/usr/local/tomcat1
export CATALINA_BASE CATALINA_HOME TOMCAT_HOME
##########1 tomcat############
##########2 tomcat##########
CATALINA_2_BASE=/usr/local/tomcat2
CATALINA_2_HOME=/usr/local/tomcat2
TOMCAT_2_HOME=/usr/local/tomcat2
export CATALINA_2_BASE CATALINA_2_HOME TOMCAT_2_HOME
##########2 tomcat##########
##########3 tomcat##########
CATALINA_3_BASE=/usr/local/tomcat3
CATALINA_3_HOME=/usr/local/tomcat3
TOMCAT_3_HOME=/usr/local/tomcat3
export CATALINA_3_BASE CATALINA_3_HOME TOMCAT_3_HOME
##########3 tomcat##########
##########4 tomcat##########
CATALINA_4_BASE=/usr/local/tomcat4
CATALINA_4_HOME=/usr/local/tomcat4
TOMCAT_4_HOME=/usr/local/tomcat4
export CATALINA_4_BASE CATALINA_4_HOME TOMCAT_4_HOME
##########4 tomcat##########
##########5 tomcat##########
CATALINA_5_BASE=/usr/local/tomcat5
CATALINA_5_HOME=/usr/local/tomcat5
TOMCAT_5_HOME=/usr/local/tomcat5
export CATALINA_5_BASE CATALINA_5_HOME TOMCAT_5_HOME
##########5 tomcat##########
##########6 tomcat##########
CATALINA_6_BASE=/usr/local/tomcat6
CATALINA_6_HOME=/usr/local/tomcat6
TOMCAT_6_HOME=/usr/local/tomcat6
export CATALINA_6_BASE CATALINA_6_HOME TOMCAT_6_HOME
##########6 tomcat##########
##########7 tomcat##########
CATALINA_7_BASE=/usr/local/tomcat7
CATALINA_7_HOME=/usr/local/tomcat7
TOMCAT_7_HOME=/usr/local/tomcat7
export CATALINA_7_BASE CATALINA_7_HOME TOMCAT_7_HOME
##########7 tomcat##########
##########8 tomcat##########
CATALINA_8_BASE=/usr/local/tomcat8
CATALINA_8_HOME=/usr/local/tomcat8
TOMCAT_8_HOME=/usr/local/tomcat8
export CATALINA_8_BASE CATALINA_8_HOME TOMCAT_8_HOME
##########8 tomcat##########
##########9 tomcat##########
CATALINA_9_BASE=/usr/local/tomcat9
CATALINA_9_HOME=/usr/local/tomcat9
TOMCAT_9_HOME=/usr/local/tomcat9
export CATALINA_9_BASE CATALINA_9_HOME TOMCAT_9_HOME
##########9 tomcat##########

Make configuration effective

source /etc/profile

Configure the profile for each tomcat

tomcat/bin/startup.sh and tomcat/bin/shutdown.sh

cd /usr/local/tomcat1/bin
vim startup.sh
//Add to the head
export JAVA_HOME=/usr/java/jdk1.8.0_171
export JRE_HOME=/usr/java/jdk1.8.0_171/jre
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export CATALINA_BASE=$CATALINA_BASE
export CATALINA_HOME=$CATALINA_HOME

vim shutdown.sh
//Add the same to the head
export JAVA_HOME=/usr/java/jdk1.8.0_171
export JRE_HOME=/usr/java/jdk1.8.0_171/jre
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export CATALINA_BASE=$CATALINA_BASE
export CATALINA_HOME=$CATALINA_HOME

Modify port number

tomcat/conf 

cd /usr/local/tomcat1/conf
 tomcat1 is modified as follows: the first place: modify and close the listening port. The default is 8005, which is changed to 1005. Of course, you can change it to any other unused port number.
<Server port="1005" shutdown="SHUTDOWN">

The second place: modify the http monitoring port. The default is 8080. Here it is changed to 1010. I have added other configurations here.
<Connector port="1010" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />

The third place: modify the corresponding port of AJP, 8009 by default, 1009:
<Connector port="1009" protocol="AJP/1.3" redirectPort="8443" />

After configuration, you can start multiple tomcat.

Tags: Tomcat Java vim

Posted on Sun, 09 Feb 2020 15:37:56 -0500 by rdimaggio