1.文件准备
jdk-8u201-linux-x64.tar.gz
下载地址 http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2.登陆主机
tar -zxvf jdk-8u201-linux-x64.tar.gz
3.编辑/etc/profile,在结尾处添加
export JAVA_HOME=/usr/java/jdk1.8.0_201
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
4.验证
[root@localhost ap]# source /etc/profile
[root@localhost ap]# java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
[root@localhost ap]#