Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Install three or more tomcat under Linux system (detailed steps)

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Even if multiple tomcat are installed, it must be established that the system already has jdk installed and will install

On the basis of a tomcat, let's go straight to the topic without too much description here.

Installing multiple tocat is more or less the same as installing one, except that you need to change some configuration.

I have installed three tomcat before. I forgot to take screenshots.

So I am going to install the fourth one today. I will record the steps in detail and take a screenshot to show that there is no problem for you to follow the steps step by step.

Step 1: copy, decompress

Copy the prepared tomcat package to the directory you are going to install, my tomcat package name is tomcat.tar.gz, and my installation directory is / usr/java/tomcat

Step 2: decompress tomcat

[root@aliServer tomcat] # tar-xvf tomcat.tar.gz

Step 3: rename the decompressed file name

The name of the decompressed folder is not intuitive enough, because I have installed three tomcat before, so I am going to name the fourth tomcat tomcat_8083

Execute a command

[root@aliServer tomcat] # mv apache-tomcat-8.5.20 tomcat_8083

Step 4: edit environment variables

[root@aliServer tomcat] # vi / etc/profile

After opening the profile file, we can see that there are the jdk environment variables we configured and the first three tomcat I have configured. Let's make a copy according to the configuration of the third tomcat (tomcat-8082) and change the name accordingly.

After adding the fourth tomcat environment variable configuration, as shown in the figure, what you should notice here is to write the path corresponding to your tomcat, because the path where my fourth tomcat is located is / usr/java/tomcat/tomcat_8083.

In order to prevent everyone from copying the added paragraph manually, post it directly.

# tomcat-8083TOMCAT_HOME_3=/usr/java/tomcat/tomcat_8083CATALINA_HOME_3=/usr/java/tomcat/tomcat_8083CATLINA_BASE_3=/usr/java/tomcat/tomcat_8083export TOMCAT_HOME_3 CATALINA_HOME_3 CATALINA_BASE_3

Step 5: make the changed profile file effective immediately

[root@aliServer ~] # source / etc/profile

Step 6: modify catalina.sh

Enter the bin directory of the fourth tomcat you just unzipped

[root@aliServer ~] # cd / usr/java/tomcat/tomcat_8083/bin

There is a catalina.sh file in it, and we edit this file.

[root@aliServer bin] # vi catalina.sh

After opening the catalina.sh file, find the location of the scarlet letter below (don't copy more spaces)

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

The way to find it is very simple, enter / OS specific support directly. $var _ must_ be set to either true or false.

When you find this location, you can see that it looks like this:

Now in OS specific support. $var _ must_ be set to either true or false. Add these two sentences to the bottom of this sentence

Export CATALINA_BASE=$CATALINA_BASE_3export CATALINA_HOME=$CATALINA_HOME_3

After the addition is complete, save and exit, as shown in the figure

Note: the CATALINA_BASE_3 place should match the name of the profile environment variable configuration you edited earlier.

Take a look at the catalina.sh my configuration under my third tomcat (that is, tomcat_8082) bin directory. By the same token, it needs to be the same as the name of the profile environment variable configuration, as shown in the figure

Step 7: modify server.xml

Go to the conf directory of the fourth tomcat

[root@aliServer bin] # cd / usr/java/tomcat/tomcat_8083/conf

Edit server.xml

[root@aliServer conf] # vi server.xml

(1): find and change the port number to 7083

This port number is written casually, do not conflict with other port numbers, and it is best to take the port number regularly.

My first tomcat port number remains unchanged by default, the second is changed to 7081, the third is 7082, and the fourth is 7083. Of course, you can also change the first to 7080.

There are two places where the port numbers need to be changed.

Before changing:

After change:

(2): find and change the port number to 8083. This 8083 is the port number of my fourth tomcat.

My first tomcat port number remains unchanged by default, the second is changed to 8081, the third is 8082, and the third is 8083

Before Chan

After Chan

(3): find and change the port number to: 9003

My first tomcat port number remains unchanged by default, it is still 8009, the second is changed to 9001, and the third is 9002. Of course, you can also change the first to 9000.

Before Chan

After change:

Step 8: start tomcat

Enter the bin directory of each tomcat and start tomcat

[root@aliServer ~] # cd / usr/java/tomcat/tomcat_8080/bin./ startup.sh [root @ aliServer ~] # cd / usr/java/tomcat/tomcat_8081/bin./ startup.sh [root @ aliServer ~] # cd / usr/java/tomcat/tomcat_8082/bin./startup.sh [root@aliServer ~] # cd / usr/java/tomcat/tomcat_8083/bin./startup.sh

OK, it's that simple.

In order to record the installation process in detail, it is a bit wordy. I hope everyone can install successfully and gain something.

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report