美文网首页
Linux CentOS 7 安装JDK详细步骤

Linux CentOS 7 安装JDK详细步骤

作者: 挂机的啊洋zzZ | 来源:发表于2019-01-03 22:48 被阅读0次
1.jpg

Linux CentOS 7 安装JDK详细步骤


第一种方式:yum命令安装

检索包含java的列表

[root@node-100 ~]# yum list java*

如果有结果类似如下:

[root@node-100 ~]# yum list java*
已加载插件:fastestmirror, langpacks
Determining fastest mirrors
* base: mirrors.nwsuaf.edu.cn
* extras: mirrors.cn99.com
* updates: mirrors.cn99.com
可安装的软件包
java-1.6.0-openjdk.x86_64                                                                   1:1.6.0.41-1.13.13.1.el7_3                                               base   
java-1.6.0-openjdk-demo.x86_64                                                              1:1.6.0.41-1.13.13.1.el7_3                                               base   
java-1.6.0-openjdk-devel.x86_64                                                             1:1.6.0.41-1.13.13.1.el7_3                                               base   
java-1.6.0-openjdk-javadoc.x86_64                                                           1:1.6.0.41-1.13.13.1.el7_3                                               base   
java-1.6.0-openjdk-src.x86_64                                                               1:1.6.0.41-1.13.13.1.el7_3                                               base   
java-1.7.0-openjdk.x86_64                                                                   1:1.7.0.201-2.6.16.1.el7_6                                               updates
java-1.7.0-openjdk-accessibility.x86_64                                                     1:1.7.0.201-2.6.16.1.el7_6                                               updates
java-1.7.0-openjdk-demo.x86_64                                                              1:1.7.0.201-2.6.16.1.el7_6                                               updates
java-1.7.0-openjdk-devel.x86_64                                                             1:1.7.0.201-2.6.16.1.el7_6                                               updates
java-1.7.0-openjdk-headless.x86_64                                                          1:1.7.0.201-2.6.16.1.el7_6                                               updates
java-1.7.0-openjdk-javadoc.noarch                                                           1:1.7.0.201-2.6.16.1.el7_6                                               updates
java-1.7.0-openjdk-src.x86_64                                                               1:1.7.0.201-2.6.16.1.el7_6                                               updates
java-1.8.0-openjdk.i686                                                                     1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk.x86_64                                                                   1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-accessibility.i686                                                       1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-accessibility.x86_64                                                     1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-accessibility-debug.i686                                                 1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-accessibility-debug.x86_64                                               1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-debug.i686                                                               1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-debug.x86_64                                                             1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-demo.i686                                                                1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-demo.x86_64                                                              1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-demo-debug.i686                                                          1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-demo-debug.x86_64                                                        1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-devel.i686                                                               1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-devel.x86_64                                                             1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-devel-debug.i686                                                         1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-devel-debug.x86_64                                                       1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-headless.i686                                                            1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-headless.x86_64                                                          1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-headless-debug.i686                                                      1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-headless-debug.x86_64                                                    1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-javadoc.noarch                                                           1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-javadoc-debug.noarch                                                     1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-javadoc-zip.noarch                                                       1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-javadoc-zip-debug.noarch                                                 1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-src.i686                                                                 1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-src.x86_64                                                               1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-src-debug.i686                                                           1:1.8.0.191.b12-1.el7_6                                                  updates
java-1.8.0-openjdk-src-debug.x86_64                                                         1:1.8.0.191.b12-1.el7_6                                                  updates
java-11-openjdk.i686                                                                        1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk.x86_64                                                                      1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-debug.i686                                                                  1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-debug.x86_64                                                                1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-demo.i686                                                                   1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-demo.x86_64                                                                 1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-demo-debug.i686                                                             1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-demo-debug.x86_64                                                           1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-devel.i686                                                                  1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-devel.x86_64                                                                1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-devel-debug.i686                                                            1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-devel-debug.x86_64                                                          1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-headless.i686                                                               1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-headless.x86_64                                                             1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-headless-debug.i686                                                         1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-headless-debug.x86_64                                                       1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-javadoc.i686                                                                1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-javadoc.x86_64                                                              1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-javadoc-debug.i686                                                          1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-javadoc-debug.x86_64                                                        1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-javadoc-zip.i686                                                            1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-javadoc-zip.x86_64                                                          1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-javadoc-zip-debug.i686                                                      1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-javadoc-zip-debug.x86_64                                                    1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-jmods.i686                                                                  1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-jmods.x86_64                                                                1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-jmods-debug.i686                                                            1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-jmods-debug.x86_64                                                          1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-src.i686                                                                    1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-src.x86_64                                                                  1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-src-debug.i686                                                              1:11.0.1.13-3.el7_6                                                      updates
java-11-openjdk-src-debug.x86_64                                                            1:11.0.1.13-3.el7_6                                                      updates
java-atk-wrapper.i686                                                                       0.30.4-5.el7                                                             base   
java-atk-wrapper.x86_64                                                                     0.30.4-5.el7                                                             base   
java_cup.noarch                                                                             1:0.11a-16.el7                                                           base   
java_cup-javadoc.noarch                                                                     1:0.11a-16.el7                                                           base   
java_cup-manual.noarch                                                                      1:0.11a-16.el7                                                           base   
javacc.noarch                                                                               5.0-10.el7                                                               base   
javacc-demo.noarch                                                                          5.0-10.el7                                                               base   
javacc-javadoc.noarch                                                                       5.0-10.el7                                                               base   
javacc-manual.noarch                                                                        5.0-10.el7                                                               base   
javacc-maven-plugin.noarch                                                                  2.6-17.el7                                                               base   
javacc-maven-plugin-javadoc.noarch                                                          2.6-17.el7                                                               base   
javamail.noarch                                                                             1.4.6-8.el7                                                              base   
javamail-javadoc.noarch                                                                     1.4.6-8.el7                                                              base   
javapackages-tools.noarch                                                                   3.4.1-11.el7                                                             base   
javassist.noarch                                                                            3.16.1-10.el7                                                            base   
javassist-javadoc.noarch                                                                    3.16.1-10.el7                                                            base   
[root@node-100 ~]# 

选择需要的JDK版本yum命令安装:

yum install -y java-1.8.0-openjdk-devel.x86_64    

检查版本:

[root@node-100 ~]# java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
[root@node-100 ~]# 

第二种方式:下载后安装

去Oracle官网下载所需JDK版本:

https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

上传至所在服务器,进行解压后

[root@node-100 jdk1.8.0_191]# pwd
/usr/local/java/jdk1.8.0_191
[root@node-100 jdk1.8.0_191]# ls
bin  COPYRIGHT  include  javafx-src.zip  jre  lib  LICENSE  man  README.html  release  src.zip  THIRDPARTYLICENSEREADME-JAVAFX.txt  THIRDPARTYLICENSEREADME.txt
[root@node-100 jdk1.8.0_191]# 

设置环境变量:

[root@node-100 ~]# vim /etc/profile

新增:

#设置jdk环境变量
export JAVA_HOME=/usr/local/java/jdk1.8.0_191  #jdk安装目录

export JRE_HOME=${JAVA_HOME}/jre

export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH

export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin

export PATH=$PATH:${JAVA_PATH}

:wq #保存

使其生效:

[root@node-100 ~]# source /etc/profile
[root@node-100 ~]# 

检查版本:

[root@node-100 ~]# java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
[root@node-100 ~]#

完。

相关文章

  • 【Linux】Jenkins安装

    安装环境准备 操作系统:Linux(CentOS7) 软件:jdk,安装及配置步骤见Linux安装jdk 软件:t...

  • Linux CentOS 7 安装JDK详细步骤

    Linux CentOS 7 安装JDK详细步骤 第一种方式:yum命令安装 检索包含java的列表 如果有结果类...

  • centos7安装jdk,tomcat,nginx,redis,

    centos7安装jdk,tomcat,nginx,redis,fastDFS的步骤* 1.linux****安装...

  • CentOS上安装jdk1.7

    Linux 下安装jdk1.7步骤: 一、上传jdk-7u79-linux-x64.tar.gz到你的CentOS...

  • Java-JDK环境配置

    下载JDK8下载地址 安装环境配置参考【Linux】CentOS7下安装JDK详细过程 卸载Mac环境的卸载方式:...

  • Linux安装ZooKeeper

    确保系统已经安装JDK,如果未安装,首先需要进行安装JDK,参考Linux(CentOS 7)安装JDK踩坑记录 ...

  • centos7 安装JDK8

    本文主要说明了在centos7系统下安装JDK8的详细步骤 1.1 下载jdk8下载jdk8 1.2 把下载好的...

  • 2018-04-19

    Centos 7 安装 tomcat7, jdk,mysql,zookeeper Centos 安装jdk 安装...

  • MongoDB 创建新用户并授权

    mongodb安装 参考安装教程:Linux Centos 7安装MongoDB(简单!详细!) 进入mongo数...

  • linux 部署tomcat应用

    一、安装jdk (centos7为例) 1.查看Linux自带的JDK是否已安装 java -version...

网友评论

      本文标题:Linux CentOS 7 安装JDK详细步骤

      本文链接:https://www.haomeiwen.com/subject/xylcrqtx.html