1, check the JDK version of the system
[[email protected] software] # java-version
Show:
" 1.8.0_102 " 1.8.0_102-64-bit Server VM (build 25.102-b14, Mixed mode)
2. Detect JDK installation package
[[email protected] software] # Rpm-qa | grep java
Show:
java-1.7.0-openjdk-1.7.0.111-2.6.7.8. El7.x86_64python-javapackages-3.4.1-11. El7.noarchtzdata -java-2016g-2. el7.noarchjavapackages-tools-3.4.1-11. El7.noarchjava-1.8.0-openjdk-1.8.0.102-4 . B14.el7.x86_64java-1.8.0-openjdk-headless-1.8.0.102-4. B14.el7.x86_64java-1.7.0- Openjdk-headless-1.7.0.111-2.6.7.8.el7.x86_64
3, uninstall OPENJDK
[[email protected] software]#rpm-e--nodeps Tzdata-java-2016g-2.el7.noarch[[email protected] software]#rpm-e--nodeps java-1.7.0-openjdk-1.7.0.111-2.6.7.8.el7.x86_64[[email protected] software]#rpm-e--nodeps java-1.7.0-openjdk-headless-1.7.0.111-2.6.7.8.el7.x86_64[[email protected] software]#rpm-e--nodeps java-1.8.0-openjdk-1.8.0.102-4.b14.el7.x86_64[[email protected] software]#rpm-e--nodeps java-1.8.0-openjdk-headless-1.8.0.102-4.b14.el7.x86_64or use [[email protected] JVM]#Yum Remove *openjdk*
Then enter RPM-QA again | grep java to view the uninstall situation:
[[email protected] software] # Rpm-qa | grep javapython-javapackages-3.4.1-11. El7.noarchjavapackages-tools-3.4.1-11.el7.noarch
4. Install a new JDK
First download the JDK version you want on the JDK website, and after the download is complete, place the JDK installation package that you need to install into the folder specified by the Linux system, and the command goes to that folder:
[[email protected] software] # llTotal 252664-rw-r--r--. 1 root root 11830603 June 9 06:43 alibaba-rocketmq-3.2.6. tar.gz-rw-r--r--. 1 root root 43399561 June 9 06:42 apache-activemq-5.11.1-bin.tar.gz-rwxrw-rw-. 1 root root 185540433 Apr 09:06 jdk-8u131-linux-< c9>x64.tar.gz-rw-r--r--. 1 root root 1547695 June 9 06:44 redis-3.2.9. tar.gz-rw-r--r--. 1 root root 16402010 June 9 06:40 zookeeper-3.4.5.tar.gz
Unzip the JDK-8U131-LINUX-X64.TAR.GZ installation package
[[email protected] software] # mkdir-p/USR/LIB/JVM [[email protected] software] # TAR-ZXVF jdk-8u131-linux-x64.tar.gz-c/USR/LIB/JVM
5. Setting Environment variables
[[email protected] software] # Vim/etc/profile
At the top of the add:
Export java_home=/usr/lib/jvm/jdk1.8. 0_131 export jre_home=${java_home}/JRE export CLASSPATH =.:${java_home}/lib:${jre_home}/lib export PATH=${java_home}/bin: $PATH
6. Execute profile File
[[email protected] software] # Source/etc/profile
This allows the configuration to take effect immediately without rebooting.
7. Check for newly installed JDK
[[email protected] software] # java-version
Show:
" 1.8.0_131 " 1.8.0_131-64-bit Server VM (build 25.131-b11, Mixed mode)
This concludes the entire installation process.
Linux installation JDK complete steps