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

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

If you want to install multiple tomcats, you must have jdk installed on the system and will install

Based on a tomcat, I will not describe it in detail here and go straight to the topic.

The way to install multiple tocats is actually very similar to installing one, but you need to change some configurations.

I have installed three tomcats before, but forgot to take a screenshot.

So today I am going to install the fourth one. I will record the steps in detail and take screenshots to illustrate. There will be no problem if you follow the steps step by step.

Step 1: Copy and unzip

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


Step 2: Unzip tomcat

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

Step 3: Rename the decompressed file name.

The name of the folder after decompression is not intuitive enough. Because I have installed three tomcats before, I plan to name the fourth tomcat tomcat_8083


Execute 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 the jdk environment variables we configured and the first three tomcats I have configured. Next, we copy the configuration of the third tomcat (tomcat-8082) and change the corresponding name.


After adding the fourth tomcat environment variable configuration, as shown in the figure, it is important to write the path corresponding to your own tomcat, because the path where my fourth tomcat is located is /usr/java/tomcat/tomcat_8083


In order to prevent everyone from manually copying this added paragraph, I will paste it directly

####tomcat-8083
TOMCAT_HOME_3=/usr/java/tomcat/tomcat_8083
CATALINA_HOME_3=/usr/java/tomcat/tomcat_8083
CATLINA_BASE_3=/usr/java/tomcat/tomcat_8083
export TOMCAT_HOME_3 CATALINA_HOME_3 CATALINA_BASE_3

Step 5: Make the modified profile file take effect immediately

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

Step 6: Modify catalina.sh

Enter the bin directory of the fourth tomcat just unzipped

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

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

[root@aliServer bin]# vi catalina.sh

After opening the catalina.sh file, find the location of the red part below (don’t copy too many spaces)

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

The search is simple, just type /OS specific support. $var _must_ be set to either true or false.

After finding this location, you can see that the unmodified version looks like this:


Now add these two sentences below the sentence OS specific support. $var _must_ be set to either true or false.

export CATALINA_BASE=$CATALINA_BASE_3


export CATALINA_HOME=$CATALINA_HOME_3

After adding, save and exit, as shown in the figure


Note: CATALINA_BASE_3 should be consistent with the name of the profile environment variable configured in the previous edit.

Let's take a look at my configuration of catalina.sh in the bin directory of my third tomcat (that is, tomcat_8082). For the same reason, the name must be consistent with the name configured in the profile environment variable, as shown in the figure


Step 7: Modify server.xml

Enter 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 <Server port="8005" shutdown="SHUTDOWN"> and change the port number to 7083

You can write this port number randomly. It should not conflict with other port numbers. It is best to be regular when choosing the port number.

My first tomcat port number is 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 one to 7080

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

Before:


After:


(2): Find <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> and change the port number to 8083. This 8083 is the port number of my fourth tomcat.

My first tomcat port number did not change by default, the second was changed to 8081, the third was 8082, and the third was 8083

Before


After


(3): Find <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> and change the port number to: 9003

My first tomcat port number is still 8009, the second is 9001, and the third is 9002. Of course, you can also change the first one to 9000.

Before


After:

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 long-winded. I hope everyone can install it successfully and gain something.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Various problems and solutions in the process of deploying Tomcat to release projects on Linux
  • Linux (center OS7) installs JDK, tomcat, mysql to build a java web project running environment
  • Detailed graphic tutorial on installing and uninstalling Tomcat8 on Linux
  • Steps to monitor Tomcat status and start it automatically using shell scripts under Linux
  • Install tomcat and deploy the website under Linux (recommended)
  • Linux (CentOS7) installs Tomcat and sets Tomcat as a startup item (taking tomcat8 as an example)
  • How to start and stop Tomcat service by writing shell script in Linux environment
  • How to change the tomcat port number in Linux

<<:  MySQL 5.7.15 version installation and configuration method graphic tutorial

>>:  jQuery plugin to implement minesweeper game (3)

Recommend

IE6 BUG and fix is ​​a preventive strategy

Original article: Ultimate IE6 Cheatsheet: How To...

How to manage large file uploads and breakpoint resume based on js

Table of contents Preface Front-end structure Bac...

Detailed explanation of LVM seamless disk horizontal expansion based on Linux

environment name property CPU x5650 Memory 4G dis...

Vue custom component implements two-way binding

Scenario: The interaction methods between parent ...

Win10 uses Tsinghua source to quickly install pytorch-GPU version (recommended)

Check whether your cuda is installed Type in the ...

Ubuntu 18.04 disable/enable touchpad via command

In Ubuntu, you often encounter the situation wher...

Learn v-model and its modifiers in one article

Table of contents Preface Modifiers of v-model: l...

Implementation of textarea adaptive height solution in Vue

Table of contents Hidden Problems Solution to ada...

Solution to the Docker container being unable to access the host port

I recently encountered a problem at work. The doc...

Use iframe to display weather effects on web pages

CSS: Copy code The code is as follows: *{margin:0;...

Simple implementation of Mysql add, delete, modify and query statements

Simple implementation of Mysql add, delete, modif...

Docker swarm simple tutorial

swarm three virtual machines 132,133,134 1. Initi...

Analysis of the principle of using PDO to prevent SQL injection

Preface This article uses pdo's preprocessing...