tomcat download address https://tomcat.apache.org/download-80.cgi
Create a new tomcat directory sudo mkdir /usr/local/tomcat
Enter the download directory (my download path is /home/moon/Downloads ) Command: cd /home/moon/Downloads
Copy the downloaded compressed package to the tomcat path (cp apache-tomcat-8.5.30.tar.gz /usr/local/tomcat)
Enter the tomcat path cd /usr/local/tomcat
Ud sudo tar xvf apache-tomcat-8.5.30.tar.gz
Delete the compressed package sudo rm apache-tomcat-8.5.30.tar.gz
Enter the apache-tomcat-8.5.30/bin directory and edit the startup.sh file
Add the following: save.
#set java environment
export JAVA_HOME=/usr/local/java/jdk1.8.0_171
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:%{JAVA_HOME}/lib:%{JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
#tomcat
export TOMCAT_HOME=/usr/tomcat/apache-tomcat-8.5.30
start tomcat
Open tomcat in the browser, and the following content appears, indicating that the installation is successful.