Installation and configuration of JDK in CentOS 7 system

   Copyright statement: This article is the original article of the blogger, please indicate the source for reprinting. https://blog.csdn.net/gongxifacai_believe/article/details/53082077

Operating system version: CentOS Linux release 7.2.1511 (Core)

JDK version: jdk-8u111-nb-8_2-linux-x64.sh

Installation method: Shell script installation

Download link: http://www.oracle.com/technetwork/java/javase/downloads/index.html

Installation preparation:

(1) Check the installed JDK version of the system (the installed JDK version is OpenJDK):

[ root@centos7 ~]# java -version
openjdk version "1.8.0_65"
OpenJDK Runtime Environment (build 1.8.0_65-b17)
OpenJDK 64-Bit Server VM (build 25.65-b01, mixed mode)

(2) View the detailed information of the installed JDK:

[ root@centos7 ~]# rpm -qa | grep java
java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64
tzdata-java-2015g-1.el7.noarch
python-javapackages-3.4.1-11.el7.noarch
javapackages-tools-3.4.1-11.el7.noarch
java-1.7.0-openjdk-headless-1.7.0.91-2.6.2.3.el7.x86_64
java-1.7.0-openjdk-1.7.0.91-2.6.2.3.el7.x86_64
java-1.8.0-openjdk-headless-1.8.0.65-3.b17.el7.x86_64

(3) Uninstall the installed OpenJDK:

[ root@centos7 ~]# rpm -e --nodeps tzdata-java-2015g-1.el7.noarch
[ root@centos7 ~]# rpm -e --nodeps java-1.7.0-openjdk-headless-1.7.0.91-2.6.2.3.el7.x86_64
[ root@centos7 ~]# rpm -e --nodeps java-1.7.0-openjdk-1.7.0.91-2.6.2.3.el7.x86_64
[ root@centos7 ~]# rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.65-3.b17.el7.x86_64
[ root@centos7 ~]# rpm -e --nodeps java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64

installation steps:

(1) Download the latest JDK 64-bit version from the above-mentioned website in the Windows system.

(2) Use WinSCP tool to transfer the downloaded JDK file to the /usr/local folder of the CentOS system in the virtual machine.

(3) Enter the /usr/local folder and check the execution permissions of the jdk-8u111-nb-8_2-linux-x64.sh script:

[ root@centos7 ~]# cd /usr/local
[ root@centos7 local]# ls
bin games jdk-8u111-nb-8_2-linux-x64.sh lib64 sbin src
etc include lib libexec share
[ root@centos7 local]# ls -l
total 289396
drwxr-xr-x. 2 root root 4096 Aug 12 2015 bin
drwxr-xr-x. 2 root root 4096 Aug 12 2015 etc
drwxr-xr-x. 2 root root 4096 Aug 12 2015 games
drwxr-xr-x. 2 root root 4096 Aug 12 2015 include

(4) Increase the execution authority of the root user to the jdk-8u111-nb-8_2-linux-x64.sh file:

[ root@centos7 local]# chmod u+x jdk-8u111-nb-8_2-linux-x64.sh
[ root@centos7 local]# ls -l
total 289396
drwxr-xr-x. 2 root root 4096 Aug 12 2015 bin
drwxr-xr-x. 2 root root 4096 Aug 12 2015 etc
drwxr-xr-x. 2 root root 4096 Aug 12 2015 games
drwxr-xr-x. 2 root root 4096 Aug 12 2015 include

(5) Run the JDK shell script:

[ root@centos7 local]# ./jdk-8u111-nb-8_2-linux-x64.sh
Configuring the installer...
Searching for JVM on the system...
Preparing bundled JVM ...
Extracting installation data...
Running the installer wizard...

(6) Start the installation wizard:

(7) Configure system variables. Add the following system variables at the end of the /etc/profile file:

JAVA_HOME=/usr/local/jdk1.8.0_111
JRE_HOME=/usr/local/jdk1.8.0_111/jre
PATH=JAVA_HOME/bin:JRE_HOME/bin:PATH CLASSPATH=.:JAVA_HOME/jre/lib/ext:JAVA_HOME/lib/dt.jar:JAVA_HOME/lib/tools.jar
export JAVA_HOME JRE_HOME PATH CLASSPATH

(8) Make the system variables in the file /etc/profile take effect (this time only takes effect temporarily, and the system variables will be automatically loaded next time the system starts to take effect permanently):

[ root@centos7 ~]# source /etc/profile

(9) Verify that the configuration is correct:

[ root@centos7 ~]# echo $PATH
/usr/local/jdk1.8.0_111/bin:/usr/local/jdk1.8.0_111/jre/bin:/usr/lib64/qt3.3/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/root/bin
[ root@centos7 ~]# java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)

Recommended Posts

Installation and configuration of JDK in CentOS 7 system
Installation and configuration of CentOS 7 in VMware Workstation
Centos7 installation and configuration of Jenkins
CentOS 7 system installation and configuration graphic tutorial
Installation and configuration of redis under centos7
CentOS 6.5 system installation and configuration graphic tutorial (detailed graphic)
Installation and configuration of rsync server under CentOS 6.5
Installation, configuration and uninstallation of GitLab in Ubuntu19.1
Centos mysql installation and configuration
Centos7 installation and configuration prometheus
CentOS 7 installation and configuration PPTP
CentOS installation and configuration cmake
Centos7.5 installation and configuration MongoDB4.0.4
CentOS 7 installation and configuration PPTP
Detailed installation steps of CentOS6.4 system in virtual machine
Environment configuration of JDK, mysql and tomcat under Centos7
Centos6.5 installation and deployment of KVM
Centos7 hadoop cluster installation and configuration
CentOS7 installation and maintenance of Gitlab
CentOS 7.X system installation and optimization
Java-JDK installation and configuration under CentOS
CentOS 7 Tomcat service installation and configuration
001. Installation of enterprise-level CentOS7.6 operating system
CentOS NTP server installation and configuration
Centos7 mysql database installation and configuration
Detailed explanation of Spark installation and configuration tutorial under centOS7
Installation and use of Mysql under CentOS
Tomcat installation and configuration under CentOS 7 (Tomcat startup)
MySQL 8.0 installation, deployment and configuration under CentOS 6/7
Centos-6.5 installation and deployment of LNMP environment
Linux kernel compilation and CentOS system installation
Centos7.6 operating system installation and optimization record
Centos7 installation and deployment of gitlab server
Installation and deployment of Nginx in Ubuntu
Centos7 hive stand-alone mode installation and configuration
Centos7 installation and deployment of Airflow detailed
OpenMPI-Ubuntu installation and configuration
CentOS 7 installation and configuration graphic tutorials under VMware10
Centos7 installation of PHP and Nginx tutorial detailed
Graphical installation of CentOS8
Mysql8.0.15 installation configuration (centos7)
MySQL 8.0 installation, deployment and configuration tutorial on CentOS 8
Installation and use of SSH in Ubuntu environment
Installation and cracking of confluence6.3 operation records under Centos
Installation and cracking of Jira7 operation records under Centos
Common issues in IDC computer room and Centos8 installation
Installation and use of GDAL in Python under Ubuntu
The difference between CentOS and Ubuntu in Linux system
Installation and simple practice of MySQL in ubuntu environment (1)
Ubuntu12 step-by-step installation and configuration (system, FTP, TELNET.. settings)
Common exceptions and solutions for Ubuntu system installation and configuration
Detailed tutorial on installing JDK8 on Linux system (CentOS7 installation)
Ubuntu16.04 installation and simple configuration
centos7 kvm installation and use
Centos7 silent installation of Oracle11g
CentOS7 postgresql installation and use
Implementation of CentOS8.0 Network Configuration
CentOS environment installation of Docker
Ubuntu PostgreSQL installation and configuration
Centos7 elk7.1.1 installation and use
CentOS7 installation and maintenance of nginx from entry to master