# cat /etc/redhat-release

CentOS release 6.9 (Final)
#yum remove java -y
下载jdk:(jdk-8u152-linux-x64.tar )
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
#tar zxvf jdk-8u152-linux-x64.tar.gz
#mv jdk1.8.0_152/ /usr/local/
#cd /usr/local/
#vim /etc/profile.d/java.sh
JAVA_HOME=/usr/local/jdk1.8.0_152
JAVA_BIN=/usr/local/jdk1.8.0_152/bin
JRE_HOME=/usr/local/jdk1.8.0_152/jre
PATH=$PATH:/usr/local/jdk1.8.0_152/bin:/usr/local/jdk1.8.0_152/jre/bin
CLASSPATH=/usr/local/jdk1.8.0_152/jre/lib:/usr/local/jdk1.8.0_152/lib:/usr/local/jdk1.8.0_152/jre/lib/charsets.jar
#source /etc/profile.d/java.sh
#java -version
[root@localhost local]# java -version
java version "1.8.0_152"
Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)
[root@localhost local]#

下载tomcat
(apache-tomcat-8.5.23.tar)
#rz
#tar -zxvf apache-tomcat-8.5.23.tar.gz
#ls
#mv apache-tomcat-8.5.23 /usr/local/tomcat
#cp -pv /usr/local/tomcat/bin/catalina.sh /etc/init.d/tomcat
#vi /etc/init.d/tomcat
从第二行加入
# chkconfig: 2345 63 37
# description: tomcat server init script
# Source Function Library
. /etc/init.d/functions
JAVA_HOME=/usr/local/jdk1.8.0_152
CATALINA_HOME=/usr/local/tomcat
保存后执行:
#chmod 755 /etc/init.d/tomcat
#chkconfig --add tomcat
#chkconfig tomcat on
#service tomcat start

test--->firefox:ip:8080