Linux CentOS 7 install JDK detailed steps

Detailed steps to install JDK on Linux CentOS 7###


The first way: yum command installation

Retrieve a list containing java

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

If there are results similar to the following:

[ root@node-100~]# yum list java*
Loaded plugin: fastestmirror, langpacks
Determining fastest mirrors
* base: mirrors.nwsuaf.edu.cn
* extras: mirrors.cn99.com
* updates: mirrors.cn99.com
Installable packages
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~]# 

Select the required JDK version and install it with the yum command:

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

Check version:

[ 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~]# 

The second way: install after downloading####

Go to the Oracle official website to download the required JDK version:

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

Upload to the server, after decompression

[ 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]# 

Set environment variables:

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

Added:

# Set jdk environment variables
export JAVA_HOME=/usr/local/java/jdk1.8.0_191  #jdk installation directory

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 #save

Make it effective:

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

Check version:

[ 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~]#

Finish.

Recommended Posts

Linux CentOS 7 install JDK detailed steps
Linux Centos7 install jdk1.8
Centos 7 install JDK (Linux install jdk)
CentOS install jdk
CentOS 7 install vsftpd steps
CentOS (linux) install PostgreSQL
CentOS7 install JDK8, tomcat8
Detailed steps to install Anaconda on Linux (Ubuntu 18.04)
Detailed steps to install Anaconda on Linux (Ubuntu 18.04)
Know Linux and install CentOS
Linux Centos7 install redis tutorial
Install MySQL 8.0.16 on Linux Centos
Install MySQL under Linux (CentOS 7)
Tencent Cloud Centos install jdk8
Install Java JDK8 under CentOS6
vmware install CentOS 7 detailed tutorial
5.1. CentOS@ install JDK1.8 graphic tutorial
CentOS 6.8 under linux install mongodb
Detailed steps to install centos on vmware10.0 cracked version
Detailed tutorial on installing JDK8 on Linux system (CentOS7 installation)
How to install jdk1.8 on centOS7
How to upgrade CentOS7 to CentOS8 (detailed steps)
Install JDK8 in rpm on CentOS7
CentOS8 install jdk8 / java8 tutorial (recommended)
CentOS7.3 install iptables and detailed use
Install MySQL on Linux CentOS7 (Windows)
CentOS6 mininal install CouchDB2 detailed version
Centos7 uninstall openJdk, and install JDK1.8
​Install Oracle database on CentOS Linux
1.5 Install Centos7
Linux CentOS6 compile and install Pyt
CentOS 6.8 method steps to install vsftpd
Use VMware15 to install Linux (CentOS6.5)
Detailed steps to install and configure k8s cluster in centos 7
Detailed steps to install virtual machines with VMware 15 and use CentOS 8
Install Jenkins on linux centos (non-docker way)
Install mysql8.0.13 version under Linux CentOS7 system
Three ways to install JDK under CentOS
How to install offline JDK1.8 on centos7.0
Centos6 install Python2.7.13
Centos7.3 install nginx
CentOS7.2 install Mysql5.7.13
Centos7 install Python 3.6.
CentOS7 install MySQL
Centos7 install protobuf
CentOS 7 install Docker
CentOS7 install GlusterFS
CentOS7 install Docker
Centos6.5 install Tomcat
CentOS install Python 3.6
Vmware install CentOS6
centos7 install docker-ce 18.01.0
CentOS 7.2 install MariaDB
CentOS 7 install Hadoop 3.0.0
Centos7 install Python2.7
Centos 7.6 install seleniu
CentOS 7.3 install Zabbix3
Centos7 install LAMP+PHPmyadmin
CentOS install mysql
CentOS install openjdk 1.8
CENTOS6.5 install CDH5.12.1 (1)