mkdir /usr/local/java/
解压: tar -xvzf jdk-8u212-linux-x64.tar.gz -C /usr/local/java/
3、编辑环境变量:vi /etc/profile在最后加上:
export JAVA_HOME=/usr/local/java/jdk1.8.0_212
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
source /etc/profile 更新环境变量
ln -s /usr/local/java/jdk1.8.0_212/bin/java /usr/bin/java 添加软连接
java –version 检查是否安装成功