1.使用openjdk,无需配置环境变量
yum list installed |grep java
yum list installed | grep java
yum -y list java*
yum install java-1.8.0-openjdk*
java -version
2.下载jdk解压到usr/local/java中
yum -y remove java-1.8.0-openjdk*
tar -vzxf jdk-8u191-linux-x64.tar.gz
vim /etc/profile
export JAVA_HOME=/ruanjian/jdk1.8.0_191
export PATH=$PATH:$JAVA_HOME/bin
source /etc/profile
3.下载tomcat
tar -zxv -f apache-tomcat-8.5.37.tar.gz
chmod +x startup.sh
firewall-cmd --state
如果上一步处于关闭状态,输入命令:
systemctl start firewalld.service
开启8080端口,输入命令:
firewall-cmd --zone=public --add-port=8080/tcp --permanent
输入命令重启防火墙;
systemctl restart firewalld.service