jdk官方下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
我选择的版本是Java SE Development Kit 8u151
安装步骤
1、下载jdk
命令:wgethttp://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.rpm?AuthParam=1509092927_5f410377708a1a8a0f5165414d53a141
2、安装
命令:rpm -ivhjdk-8u151-linux-x64.rpm
3、配置环境变量
命令:1)vi /etc/profile 进入环境变量文件
2)source /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_151
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
将这段代码写入保存