Deploy multiple Tomcat servers on Linux

Deploy multiple Tomcat servers on Linux

1. Upload the downloaded tomcat installation package to linux

Use the decompression command to decompress the file to the specified directory: tar -zxvf apache-tomcat-9.0.13.tar.gz -C /usr/local/
2. Modify multiple tomcat instance names

insert image description here
3. Modify the /etc/profile file and add two tomcat path configurations at the end of the file

`CATALINA_BASE=/usr/local/tomcat8080/apache-tomcat-9.0.65
CATALINA_HOME=/usr/local/tomcat8080/apache-tomcat-9.0.65
TOMCAT_HOME=/usr/local/tomcat8080/apache-tomcat-9.0.65
export CATALINA_BASE CATALINA_HOME TOMCAT_HOME

CATALINA2_BASE=/usr/local/tomcat8081
CATALINA2_HOME=/usr/local/tomcat8081
TOMCAT2_HOME=/usr/local/tomcat8081
export CATALINA_One_BASE CATALINA_One_HOME TOMCAT_One_HOME`

insert image description here
After modifying the file, enter the command: source /etc/profile to refresh the configuration, otherwise it will not take effect
4. Enter the bin directory of the second Tomcat to modify the catalina.sh file.

The first Tomcat needs no changes

The second Tomcat replaces CATALINA_BASE and CATALINA_HOME in catalina.sh in batches with the information corresponding to the second tomcat configured in /etc/profile

Switch directory: cd /usr/local/tomcat8081/bin

Modify the file: vim catalina.sh

Batch replacement:

%s/CATALINA_BASE/CATALINA2_BASE/g

%s/CATALINA_HOME/CATALINA2_HOME/g
5. Modify the port number in server.xml under the conf directory of tomcat:

Note: The first one doesn't need to modify anything except your own needs

Modify the information of the second tomcat:
change the closed port 8005 to 8006 and
the service port 8080 to 8081
insert image description here
insert image description here
6. At this point, the configuration has been completed. In the /bin directory of each tomcat, we start the two tomcats in turn, enter Command: ps -ef |grep tomcat View process
insert image description here
Two tomcats can also be accessed successfully in the browser
insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/adaizzz/article/details/129995526