1. yum list java*
  2. yum list installed | grep java #查看已安装版本
  3. yum -y remove java-1.7.0-openjdk*
  4. yum -y remove java-1.6.0-openjdk*
  5. # jre
  6. yum install java-1.8.0-openjdk.x86_64
  7. # jdk
  8. yum install -y java-1.8.0-openjdk-devel.x86_64
  9. # 配置
  10. sudo vim /etc/profile
  11. source /etc/profile
  12. JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64
  13. JRE_HOME=$JAVA_HOME/jre
  14. CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
  15. PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
  16. export JAVA_HOME JRE_HOME CLASS_PATH PATH
  17. java -version

Linux下安装java及配置(yum安装)

CentOs7.5yum安装JDK1.8详细过程

centos安装jdk1.8的三种方法

CENTOS7安装JAVA

Centos安装java总结

centos7 通过yum安装Java后,查看Java安装路径