https://blog.csdn.net/qq_32706349/article/details/84800865
1、到官网下载jdk-8u161-linux-i586.tar.gz,将该包上传到linux服务器上,进行解压,这里解压到/usr/local/jdk1.8.0_161
2、进行配置
vi /etc/profile,在文件末尾加上
JAVA_HOME=/usr/local/jdk1.8.0_161
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME
export PATH
export CLASSPATH
执行source /etc/profile,使得上述配置生效
3、验证安装结果
在Linux终端执行java -version,有如下类似信息输出,则证明安装成功
[root@zcfLinux jdk1.8.0_161]# java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) Client VM (build 25.161-b12, mixed mode)