Download address http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.30/bin/apache-tomcat-8.5.30.tar.gz
Unzip:
sudo tar -zxvf apache-tomcat- 8.5 . 9 .tar.gz
First create a new folder tomcat under /usr, and then move the folder apache-tomcat-8.5.9 to the directory /usr/tomcat:
sudo mv apache-tomcat-8.5.9 /usr/tomcat/
Enter the directory /usr/tomcat to view the folder, indicating that the move is successful:
Now modify the permissions of the tomcat folder first, otherwise you may not be able to enter the bin directory under the current user:
cd /usr
sudo chmod 755 -R tomcat
Then enter the directory /usr/tomcat/apache-tomcat-8.5.9/bin, edit the file startup.sh, and add the following information before the last line:
#set java environment
export JAVA_HOME=/usr/java/jdk1.8.0_111
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.9
Among them, JAVA_HOME and TOMCAT_HOME should correspond to your own jdk and tomcat installation directories. After editing, save and exit, and then run startup.sh:
sudo ./startup.sh
window 查看 ip:8080