cd /usr/local/src #Switch to this directory
wget url #Download the tar package of jdk8
tar -zxvf jdk-8u152-linux-x64.tar.gz
mv jdk1.8_152 ../jdk8
vim /etc/profile
# Append the following code at the end of the file
JAVA_HOME=/usr/local/jdk8
JRE_HOME=/usr/local/jdk8/jre
CLASS_PATH=.:$JAVA_HOME/lib
PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
export JAVA_HOME JRE_HOME PATH CLASS_PATH
# Update the configuration after the addition is complete
source /etc/profile
# Check whether the installation is successful and display the following content, which is ok
[ root@VM_177_101_centos conf]# java -version
java version "1.8.0_161"Java(TM) SE Runtime Environment(build 1.8.0_161-b12)
Java HotSpot(TM)64-Bit Server VM(build 25.161-b12, mixed mode)
Recommended Posts