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

MySQL uses SQL statements to modify table names

In MySQL, you can use the SQL statement rename ta...

Web Design Experience: 5 Excellent Web Design Concepts Full Analysis (Pictures)

Unlike other types of design, web design has been ...

How to use CocosCreator to create a shooting game

Analyze the production steps: 1. Prepare resource...

How to reset the root password of Mysql in Windows if you forget it

My machine environment: Windows 2008 R2 MySQL 5.6...

Installation of mysql-community-server. 5.7.18-1.el6 under centos 6.5

Use the following command to check whether MySQL ...

Nginx defines domain name access method

I'm building Nginx recently, but I can't ...

A detailed summary of HTML tag nesting rules suitable for beginners

I have been relearning HTML recently, which can be...

Detailed explanation of using echarts map in angular

Table of contents Initialization of echart app-ba...

A brief discussion on the use of Web Storage API

Table of contents 1. Browser local storage techno...

One line of code solves various IE compatibility issues (IE6-IE10)

x-ua-compatible is used to specify the model for ...

A brief discussion on the three major issues of JS: asynchrony and single thread

Table of contents Single thread asynchronous Sing...

Javascript asynchronous programming: Do you really understand Promise?

Table of contents Preface Basic Usage grammar Err...

MySQL helps you understand index pushdown in seconds

Table of contents 1. The principle of index push-...