阿里云ECS--CentOS8安装jdk1.8
安装方法
CentOS8上使用 yum 直接安装,环境变量自动配置好
查看是否已安装
看到如下结果说明安装成功
[root@xxx ~]# java -version openjdk version "1.8.0_222" OpenJDK Runtime Environment (build 1.8.0_222-b10) OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
查看系统是否自带 jdk
如果有输出信息,批量卸载系统自带
如果使用 yum 安装的 jdk,请使用下面命令卸载
查看jdk1.8最新版本
yum install java-1.8.0-openjdk* -y
可以看到如下输出
[root@xxx ~]# yum list java-1.8* Last metadata expiration check: 0:02:27 ago on Wed 26 Feb 2020 12:55:51 PM CST. Available Packages java-1.8.0-openjdk.x86_64 1:1.8.0.242.b08-0.el8_1 AppStream java-1.8.0-openjdk-accessibility.x86_64 1:1.8.0.242.b08-0.el8_1 AppStream java-1.8.0-openjdk-demo.x86_64 1:1.8.0.242.b08-0.el8_1 AppStream java-1.8.0-openjdk-devel.x86_64 1:1.8.0.242.b08-0.el8_1 AppStream java-1.8.0-openjdk-headless.x86_64 1:1.8.0.242.b08-0.el8_1 AppStream java-1.8.0-openjdk-javadoc.noarch 1:1.8.0.242.b08-0.el8_1 AppStream java-1.8.0-openjdk-javadoc-zip.noarch 1:1.8.0.242.b08-0.el8_1 AppStream java-1.8.0-openjdk-src.x86_64 1:1.8.0.242.b08-0.el8_1 AppStream