1.官网下载jdk包(后缀为tar.gz)
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2.通过xftp上传tar.gz到CentOs服务器
3.创建文件夹,存储 JDK
mkdir /root/java
4.解压tar.gz包
tar zxvf jdk-8u181-linux-x64.tar.gz -C /root/java
5.配置环境变量
export JAVA_HOME=/root/java/jdk1.8.0_181 export CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar export PATH=$PATH:${JAVA_HOME}/bin
6.刷新配置
source /etc/profile
7.查看JDK是否安装成功
java -version