环境:centos7.5ip地址:192.168.0.911、安装 JDKTomcat 的安装依赖 JDK,在安装 Tomcat 之前需要先安装 Java JDK。输入命令 java -version,如果显示 JDK 版本,证明已经安装了 JDKjdk安装请参照:https://www.cnblogs.com/effortsing/p/10012211.html 2、安装 Tomcat2.1、解压安装包rz apache-tomcat-8.5.31.tar.gztar xf apache-tomcat-8.5.31.tar.gz mv apache-tomcat-8.5.31 /usr/local/tomcat2.2、启动romcat /usr/local/tomcat/bin/catalina.sh start 2.3、查看端口 [root@bogon tomcat]# netstat -tnlp Active Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 192.168.0.91:5601 0.0.0.0:* LISTEN 15053/node tcp 0 0 192.168.0.91:9100 0.0.0.0:* LISTEN 14232/grunt tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 943/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1173/master tcp6 0 0 127.0.0.1:9600 :::* LISTEN 28715/java tcp6 0 0 127.0.0.1:8005 :::* LISTEN 30058/java tcp6 0 0 :::8009 :::* LISTEN 30058/java tcp6 0 0 :::8080 :::* LISTEN 30058/java tcp6 0 0 192.168.0.91:9200 :::* LISTEN 14105/java tcp6 0 0 192.168.0.91:9300 :::* LISTEN 14105/java tcp6 0 0 :::22 :::* LISTEN 943/sshd tcp6 0 0 ::1:25 :::* LISTEN 1173/master 2.4、查看进程 ps -ef | grep tomcat2.5、访问tomcat首页http://192.168.0.91:80802.6、增加tomcat网页mkdir -p /usr/local/tomcat/webapps/webdir/cat >>/usr/local/tomcat/webapps/webdir/index.html<welcome to use tomcat
EOF2.7、浏览器访问http://192.168.0.91:8080/webdir/index.htmlwelcome to use tomcat2.8、停止tomcat直接kil -9 30058