jdk下载地址: https://www.oracle.com/java/technologies/javase-jdk8-downloads.html

或者:https://www.oracle.com/java/technologies/oracle-java-archive-downloads.html

这里提供百度云下载:链接: https://pan.baidu.com/s/1_fSe_nkdoZ_QhidbQyZ1ig 提取码: ttpw

准备环境

  • centos7 虚拟机

手动安装

检查系统是否已经安装了jdk,有就卸载默认的jdk

rpm -qa | grep jdk
ava-1.6.0-openjdk-1.6.0.35-1.13.7.1.el6_6.x86_64
java-1.7.0-openjdk-1.7.0.79-2.5.5.4.el6.x86_64
[root@node1 ~]# rpm -e --nodeps java-1.6.0-openjdk-1.6.0.35-1.13.7.1.el6_6.x86_64
[root@node1 ~]# rpm -e --nodeps java-1.7.0-openjdk-1.7.0.79-2.5.5.4.el6.x86_64

下载安装jdk

wget https://download.oracle.com/otn/java/jdk/8u251-b08/3d5a2bb8f8d4428bbe94aed7ec7ae784/jdk-8u251-linux-x64.tar.gz

tar zxvf jdk-8u251-linux-x64.tar.gz -C /usr/local

# 配置环境变量
vi /etc/profile

export JAVA_HOME=/usr/local/jdk1.8.0_251
export PATH=$PATH:$JAVA_HOME/bin

# 保存退出
:wq

source /etc/profile

# 验证
java -version