System Environment: Centos7
First, download jdk8.0
jdk official website: https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Download the appropriate version of jdk. My linux is 64, and here I chose the JDK-8u221-linux-x64.tar.gz .
Click to login or downloaded from the download link below Baidu cloud.
jdk8u131: wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz
Baidu Cloud: link: https: //pan.baidu.com/s/1vlCbdVmjKi9gL0Hb6O28Lg extraction code: rnad
Second, extract the tar package
1. Download the tar package uploaded via ftp to the server, and here I put / home path
1 [root@localhost home]# ls 2 jdk-8u221-linux-x64.tar.gz
2. Extract
1 [root@localhost home]# tar -zxvf jdk-8u221-linux-x64.tar.gz
…… 2 [root@localhost home]# ls 3 jdk1.8.0_221 jdk-8u221-linux-x64.tar.gz
Rename the jdk1.8.0_221 jdk
. 1 [Home the root @ localhost] # Music Videos jdk1.8.0_221 / JDK 2 [the root @ localhost Home] -Al LS # . 3 Total amount 190 524 . 4 drwxr-XR-X.. 3 the root 51 is the root. 9 13:08 dated 18 is. . 5 DR -xr-xr-x 17 root root 224 . 9 dated 14:02 .. 16. . 6 drwxr XR-X-143. 7 10. 7 245 dated JDK 19:37. 4. . 7 -rw-R & lt -.. 1 the root r-- root 195094741 9 Yue 18 12:57 jdk-8u221-linux- x64.tar.gz
Third, set environment variables jdk
- vi / etc / profile
Press shift + g jump to the end of the document, edit it to add environment variables jdk press o
. 1 Export the JAVA_HOME = / Home / jdk // file path where the jdk 2 Export the JRE_HOME the JAVA_HOME = $ {} / JRE . 3 Export the CLASSPATH =:. $ {The JAVA_HOME} / lib: $ {} the JRE_HOME / lib . 4 Export the PATH = $ {JAVA_HOME} / bin: $ PATH
Re-initialize the profile configuration file
- . /etc/profile
1 [root@localhost home]# . /etc/profile 2 [root@localhost home]# java -version 3 java version "1.8.0_221" 4 Java(TM) SE Runtime Environment (build 1.8.0_221-b11) 5 Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)
jdk8.0 installed successfully!