The tomcatq startup principle is described as follows:
1. When tomcat starts, it will search for the root directory of tomcat, and it will search through the two variables CATALINA_BASE and CATALINA_HOME, so the root directory of different tomcat on different servers and the values of the above two variables are different. , so we'll set it up.
2. The tomcat server needs to be configured with three ports to start. These three ports are configured and enabled by default during installation, so when you want to run multiple tomcat services, you need to modify these three ports, which cannot be the same to prevent port conflicts.
【webapp@WEBAPP95~】unzip apache-tomcat-7.0.82.zip -d apache-tomcat-7.0.82
【root@WEBAPP95 webapp】# vim /etc/profile
#########jdk###########
export JAVA_HOME=/webapps/IBM/Websphere/ApppServer/java_1.7_64
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
#########tomcat1#######
export CATALINA_HOME=/home/webapp/tomcat1/apache-tomcat-7.0.82
export CATALINA_BASE=/home/webapp/tomcat1/apache-tomcat-7.0.82
export TOMCAT_HOME=/home/webapp/tomcat1/apache-tomcat-7.0.82
#########tomcat2#######
export CATALINA_HOME_2=/home/webapp/tomcat2/apache-tomcat-7.0.82
export CATALINA_BASE_2=/home/webapp/tomcat2/apache-tomcat-7.0.82
export TOMCAT_HOME_2=/home/webapp/tomcat2/apache-tomcat-7.0.82
#########tomcat3#######
export CATALINA_HOME_3=/home/webapp/tomcat3/apache-tomcat-7.0.82
export CATALINA_BASE_3=/home/webapp/tomcat3/apache-tomcat-7.0.82
export TOMCAT_HOME_3=/home/webapp/tomcat3/apache-tomcat-7.0.82
[root@WEBAPP95 webapp]# source /etc/profile #Environment variables take effect
Notice:
Except for the first tomcat, which does not need to be modified, the calalina.sh of tomcat2 and tomcat3 need to be added as follows:
【webapp@WEBAPP95 bin】vim catalina.sh
turn up
# OS specific support. $var _must_ be set to either true or false.
Add the following code below
export CATALINA_HOME=$CATALINA_HOME_2
export CATALINA_BASE=$CATALINA_BASE_2
tomcat3 is also added here in turn.