Get the App
SLTechnology News&Howtos  ›  Servers  › 

Install two or more tomcat under linux system

Shulou Source: shulou.com Published: 2022-06-02 17:52:54 11月15日 Update

1. Edit environment variables: vi / etc/profile

Add the following code (tomcat path to configure your own actual tomcat installation directory)

# first tomcat#

CATALINA_BASE=/usr/local/tomcat

CATALINA_HOME=/usr/local/tomcat

TOMCAT_HOME=/usr/local/tomcat

Export CATALINA_BASE CATALINA_HOME TOMCAT_HOME

# first tomcat#

# second tomcat#

CATALINA_2_BASE=/usr/local/tomcat_2

CATALINA_2_HOME=/usr/local/tomcat_2

TOMCAT_2_HOME=/usr/local/tomcat_2

Export CATALINA_2_BASE CATALINA_2_HOME TOMCAT_2_HOME

# second tomcat#

Save exit.

Then enter: source / etc/profile to take effect.

The first tomcat, keep the decompressed as it is without modification.

two。 Go to the bin directory of the second tomcat

Open catalina.sh and find the scarlet letter below

# OS specific support. $var _ must_ be set to either true or false.

Add the following code below

Export CATALINA_BASE=$CATALINA_2_BASE (whatever the name of the variable defined above is defined here)

Export CATALINA_HOME=$CATALINA_2_HOME

3. Go to the conf directory of the second tomcat

Open the server.xml to change the port:

Modify the server.xml configuration and the first different startup and shutdown listening port.

The modified example is as follows:

Port: 8005-> 9005

9080

MaxThreads= "150" minSpareThreads= "25" maxSpareThreads= "75"

EnableLookups= "false" redirectPort= "8443" acceptCount= "100"

ConnectionTimeout= "20000" disableUploadTimeout= "true" / >

9009

EnableLookups= "false" redirectPort= "8443" protocol= "AJP/1.3" / >

Go to the bin directory of the two tomcat, and start tomcat--./startup.sh

Then visit both http://localhost:8080 and http://localhost:9080 to see the familiar tomcat welcome interface.

If you want to start more than one, you can follow this analogy.

Transferred from: https://www.cnblogs.com/shihaiming/p/5896283.html

Tags: Directory port code variable configuration two multiple different above no in-situ actual environment interface example scarlet letter path transfer from monitor and so on Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Xiaomi NVidia Docker OPPO Reno