解压
[root@192 opt]# tar -zxvf jdk-linux-x64.tar.gz
编辑/etc/profile文件,加入环境变量配置
export JAVA_HOME=/opt//jdk1.8.0_131
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
输入source /etc/profile,使之立即生效
测试
[root@192 opt]# java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)