查看Centos发行版本
[root@lavm-ik3g4r3pga ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
查看java8安装包
[root@lavm-ik3g4r3pga ~]# yum list java-1.8*
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
安装java8
[root@lavm-ik3g4r3pga ~]# yum install java-1.8.0-openjdk.x86_64
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
base
[root@lavm-ik3g4r3pga ~]# yum install java-1.8.0-openjdk-devel.x86_64
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package java-1.8.0-openjdk-devel.x86_64 1:1.8.0.372.b07-1.el7_9 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
查看安装效果
[root@lavm-ik3g4r3pga ~]# java -version
openjdk version "1.8.0_372"
OpenJDK Runtime Environment (build 1.8.0_372-b07)
OpenJDK 64-Bit Server VM (build 25.372-b07, mixed mode)
[root@lavm-ik3g4r3pga ~]# javac -version
javac 1.8.0_372
标签:Centos,Repository,once,than,listed,configuration,安装,Java8,more
From: https://www.cnblogs.com/heyangyi/p/18082611