centos6 yum安装jdk1.8+

一、环境

Linux操作系统: centos6.9

安装jdk版本: jdk1.8+

 

二、安装步骤

1、 检查系统是否自带有jdk

[root@VM_0_11_centos ~]# rpm -qa |grep java
[root@VM_0_11_centos ~]# rpm -qa |grep jdk
[root@VM_0_11_centos ~]# rpm -qa |grep gcj

     如果有信息输出则需要卸载掉原来的jdk版本,用rpm -e ...  例如: 卸载掉java

[root@VM_0_11_centos ~]# rpm -e java

2、 yum查找 java 1.8+ 的信息 

[root@VM_0_11_centos ~]# yum list java-1.8*
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * webtatic: uk.repo.webtatic.com
nginx                                                                                                       | 2.9 kB     00:00     
Available Packages
java-1.8.0-openjdk.x86_64                                                1:1.8.0.171-8.b10.el6_9                                 os
java-1.8.0-openjdk-debug.x86_64                                          1:1.8.0.171-8.b10.el6_9                                 os
java-1.8.0-openjdk-demo.x86_64                                           1:1.8.0.171-8.b10.el6_9                                 os
java-1.8.0-openjdk-demo-debug.x86_64                                     1:1.8.0.171-8.b10.el6_9                                 os
java-1.8.0-openjdk-devel.x86_64                                          1:1.8.0.171-8.b10.el6_9                                 os
java-1.8.0-openjdk-devel-debug.x86_64                                    1:1.8.0.171-8.b10.el6_9                                 os
java-1.8.0-openjdk-headless.x86_64                                       1:1.8.0.171-8.b10.el6_9                                 os
java-1.8.0-openjdk-headless-debug.x86_64                                 1:1.8.0.171-8.b10.el6_9                                 os
java-1.8.0-openjdk-javadoc.noarch                                        1:1.8.0.171-8.b10.el6_9                                 os
java-1.8.0-openjdk-javadoc-debug.noarch                                  1:1.8.0.171-8.b10.el6_9                                 os
java-1.8.0-openjdk-src.x86_64                                            1:1.8.0.171-8.b10.el6_9                                 os
java-1.8.0-openjdk-src-debug.x86_64                                      1:1.8.0.171-8.b10.el6_9                                 os

 3、 安装jdk1.8.0的所有文件

[root@VM_0_11_centos ~]# yum install java-1.8.0-openjdk* -y

4、 检查是否安装成功

[root@VM_0_11_centos ~]# java -version
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-b10)
OpenJDK 64-Bit Server VM (build 25.171-b10, mixed mode)

 

你可能感兴趣的:(服务器配置,jdk,centos)