1. 安装tomcat 8
到官网下载tomcat
http://tomcat.apache.org/download-80.cgi
wget https://mirrors.bfsu.edu.cn/apache/tomcat/tomcat-8/v8.5.61/bin/apache-tomcat-8.5.61.tar.gzwget https://mirrors.bfsu.edu.cn/apache/tomcat/tomcat-8/v8.5.61/bin/apache-tomcat-8.5.61.tar.gz
2. 服务器下载压缩包
将文件上传到服务器,我选择安装在/etc/tomcat8目录下
tar -zxvf apache-tomcat-8.5.53.tar
mv apache-tomcat-8.5.53/ tomcat8
3. 启动tomcat测试
/etc/tomcat8/bin/startup.sh
输出信息
Using CATALINA_BASE: /etc/tomcat8
Using CATALINA_HOME: /etc/tomcat8
Using CATALINA_TMPDIR: /etc/tomcat8/temp
Using JRE_HOME: /usr/jdk1.8.0_241/jre
Using CLASSPATH: /etc/tomcat8/bin/bootstrap.jar:/etc/tomcat8/bin/tomcat-juli.jar
Tomcat started.
查看是否监听8080端口
netstat -nplt | percol
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 31192/java
打开localhost:8080查看是否启动成功
4. 关闭tomcat
执行shutdown.sh脚本即可
/etc/tomcat8/bin/shutdown.sh
输出信息
Using CATALINA_BASE: /etc/tomcat8
Using CATALINA_HOME: /etc/tomcat8
Using CATALINA_TMPDIR: /etc/tomcat8/temp
Using JRE_HOME: /usr/jdk1.8.0_241/jre
Using CLASSPATH: /etc/tomcat8/bin/bootstrap.jar:/etc/tomcat8/bin/tomcat-juli.jar
5. 参考:
https://www.cnblogs.com/h–d/p/5071643.html
https://www.cnblogs.com/yw-ah/p/9770971.html