阿里云帮助: http://mirrors.aliyun.com/help/centos
CentOS-Base.repo
到/etc/yum.repos.d/
mv mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum makecache
uname -a
rpm -qa | grep jdk
查看自带的jdk,执行sudo yum remove xxx
/usr/java/jdk1.8.xxx_xx/jre/bin/java
并连接到/usr/bin/java
cd ~
wget --no-cookies --no-check-certificate \
--header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" \
"http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.rpm"
rpm -ivh jdk-8u151-linux-x64.rpm
rm ~/jdk-8u151-linux-x64.rpm
vim /etc/profile
,添加 export JAVA_HOME=/usr/java/jdk1.8.0_151
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
source /etc/profile
生效