1.安装jdk
a.下载jdk
yum install java-1.8.0-openjdk java-1.8.0openjdk-devel
输入java -version测试一下是否安装成功
b.设置环境变量
# set java env
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64
JRE_HOME=$JAVA_HOME/jre CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH
2.安装tomcat
a.找到tomcat镜像链接
https://mirrors.cnnic.cn/apache/tomcat/
b.linux执行wget命令下载tar包
wget https://mirrors.cnnic.cn/apache/tomcat/tomcat-8/v8.5.47/bin/apache-tomcat-8.5.47.tar.gz
c.解压tar包
tar -zxvf apache-tomcat-8.5.47.tar.gz
d.跳转到解压目录,启动tomcat
[root@VM_0_17_centos apache-tomcat-8.5.47]# sh bin/startup.sh
Using CATALINA_BASE: /usr/local/apache-tomcat-8.5.47
Using CATALINA_HOME: /usr/local/apache-tomcat-8.5.47
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-8.5.47/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/local/apache-tomcat-8.5.47/bin/bootstrap.jar:/usr/local/apache-tomcat-8.5.47/bin/tomcat-juli.jar
Tomcat started.
e.打开ip+8080端口 访问tomcat页面