1.下载jdk1.8
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
我选的是jdk-8u301-linux-x64.tar.gz,可以根据自己需求选择
2.将下载好的包上传通过xftp上传到Linux ,一般jdk的默认安装路径为 /usr/local
3.解压
tar -zxvf jdk-8u301-linux-x64.tar.gz
4.修改环境变量
vim /etc/profile
export JAVA_HOME=/usr/local/jdk1.8.0_301
PATH=${JAVA_HOME}/bin:$PATH
CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
export PATH=$PATH:/sangto/mysql/mysql-5.6/bin
5.生效 /etc/profile文件
6.查看jdk版本
Java -version