- 下载jdk
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
- 安装
rpm -ivh jdk-8u151-linux-x64.rpm
- 设置环境变量:vim /etc/profile.d/java.sh
#!/bin/bash
export JAVA_HOME=/usr/java/jdk1.8.0_151/
export PATH=$JAVA_HOME/bin:$PATH
- 生效
chmod +x /etc/profile.d/java.sh
source /etc/profile.d/java.sh