1. Create a Java directory under the/usr/directory
[Email protected] ~]# Mkdir/usr/java
[Email protected] ~]# Cd/usr/java
2. Copy jdk1.8 to the Java directory, unzip to the current directory
[Email protected] java]# TAR-ZXVF jdk-8u131-linux-x64.tar.gz
3. Setting Environment variables
[Email protected] java]# Vi/etc/profile
I add the following information
Set Java environment
java_home=/usr/java/jdk1.8.0_131
Jre_home=/usr/java/jdk1.8.0_131/jre
Class_path=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar: $JRE _home/lib
Path= $PATH: $JAVA _home/bin: $JRE _home/bin
Export Java_home jre_home Class_path PATH
: Wq Save Exit
Let the saved environment variable take effect
[Email protected] java]# Source/etc/profile
Verify that the JDK configuration is in effect
[Email protected] java]# java-version
OPENJDK Version "1.8.0_102"
OpenJDK Runtime Environment (build 1.8.0_102-b14)
OpenJDK 64-bit Server VM (build 25.102-b14, Mixed mode)
Linux CentOS 7 under JDK installation