Detailed tutorial on installing Tomcat8.5 in Centos8.2 cloud server environment

Detailed tutorial on installing Tomcat8.5 in Centos8.2 cloud server environment

Before installing Tomcat, install the JDK environment first

You can read my previous articles about installing JDK and configuring the environment about the problems encountered in configuring the Java environment on Linux servers.

Go to the Apache official website to download the Tomcat8.5 installation package, https://tomcat.apache.org/

You can also choose other versions of Tomcat

Select Tomcat8 here, https://tomcat.apache.org/download-80.cgi

wget command + copied download address

wget https://mirrors.bfsu.edu.cn/apache/tomcat/tomcat-8/v8.5.60/bin/apache-tomcat-8.5.60.tar.gz

Downloaded, unzip

tar -zxvf apache-tomcat-8.5.60.tar.gz

The Tomcat name is too long, you can change it. Here I change it to tomcat8.5.8010 , which means the tomcat8.5 version is 8.5 and the listening port is 8010

mv apache-tomcat-8.5.60 tomcat8.5.8010
  • Change the Tomcat port number. Because there are many projects, it is best to deploy one Tomcat for one project, so the default listening port 8080 is definitely not enough. It is best to change it to another port.
  • Switch to the conf folder in the Tomcat directory and open server.xml
vim server.xml

Find the port number 8080 , change it to 8010 , save and exit

Note: The security group on the cloud server must open port 8010 and防火墻must also allow port 8010

firewall-cmd --zone=public --add-port=8010/tcp --permanent

This successfully adds port 8010 to public zone. The permanent parameter means it will take effect permanently, even if it is restarted. Finally, don't forget to update the firewall rules:

firewall-cmd --reload

Check all open ports in public area with the following command:

firewall-cmd --zone=public --list-ports 

  • Before adding Tomcat environment variables, you must add Java environment variables, otherwise it will not work. You can refer to my article for configuration: Problems encountered in configuring the java environment on Linux servers
  • You can also add the Tomcat path to the environment variable, so that you don't have to switch to Tomcat's bin directory to execute commands every time you start or shut down Tomcat. You can execute commands in any path.
vim /etc/profile

Open and add it at the end

export JAVA_HOME=/usr/local/jdk1.8.0_271/
export CLASSPATH=%JAVA_HOME%/lib:%JAVA_HOME%/jre/lib
export TOMCAT_HOME=/www/server/tomcat8.5.8010/
export PATH=$TOMCAT_HOME/bin:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH 

Reload the configuration to take effect

source /etc/profile

Test the Java environment:

Finally, test whether the configuration is successful, start or shut down Tomcat in other directories, such as: start Tomcat in the root directory
Note: When starting or stopping Tomcat in the bin directory, be sure to include /startup.sh . If you have added environment variables, you don't need to add ./

startup.sh
shutdown.sh 

Access: Cloud server public IP: 8010

It is not really necessary to add the Tomcat directory to the environment variables, because if you need to install several Tomcats on a server, it would be troublesome to configure the environment every time. Here we recommend another method, which is somewhat similar to the shortcut of the Windows environment. For details, please refer to the environment configuration of nginx that I configured to achieve:
Compile and install the latest stable version of nginx on Centos8.0

This is the end of this article about the detailed tutorial on installing Tomcat8.5 in the Centos8.2 cloud server environment. For more information about installing Tomcat8 in the Centos8.2 cloud server, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Alibaba Cloud Server Tomcat cannot be accessed
  • Solution to slow response of Tomcat server
  • Detailed steps for configuring Tomcat server in IDEA 2020
  • Detailed steps for installing JDK and Tomcat on Linux cloud server (recommended)
  • Tomcat Server Getting Started Super Detailed Tutorial

<<:  Detailed explanation of the deep and shallow cloning principles of JavaScript arrays and non-array objects

>>:  XHTML Getting Started Tutorial: What is XHTML?

Recommend

Detailed example of deploying Nginx+Apache dynamic and static separation

Introduction to Nginx dynamic and static separati...

Table Tag (table) In-depth

<br />Table is a tag that has been used by e...

A Guide to Optimizing High-Performance Websites

Golden Rules of Performance: Only 10% to 20% of e...

Detailed explanation on how to install MySQL database on Alibaba Cloud Server

Preface Since I needed to install Zookeeper durin...

MySQL uses custom sequences to implement row_number functions (detailed steps)

After reading some articles, I finally figured ou...

Incomplete solution for using input type=text value=str

I encountered a very strange problem today. Look a...

How to configure domestic sources in CentOS8 yum/dnf

CentOS 8 changed the software package installatio...

How to uninstall MySQL 8.0 version under Linux

1. Shut down MySQL [root@localhost /]# service my...

Two ways to export csv in win10 mysql

There are two ways to export csv in win10. The fi...

Example code for implementing anti-shake in Vue

Anti-shake: Prevent repeated clicks from triggeri...

JavaScript to implement limited time flash sale function

This article shares the specific code of JavaScri...

Detailed tutorial on uploading and configuring jdk and tomcat on linux

Preparation 1. Start the virtual machine 2. git t...

How to export and import .sql files under Linux command

This article describes how to export and import ....