1 下載官網jdk-7u80-linux-x64.tar.gzjava
2 解壓文件node
tar zxvf jdk-7u80-linux-x64.tar.gz - C / usr / local/
3 設置環境變量
vi /etc/profilelinux
JAVA_HOME=/usr/local/jdk1.7.0_80centos
PATH=$JAVA_HOME/bin:$PATHspa
export JAVA_HOMEblog
export PATH
變量生效
source /etc/profile
備註centos 卸載已安裝的jdk
查詢安裝
rpm -qa | grep jdk
卸載安裝
yum -y remove jdk
rem
卸載jdk變量
rpm -qa | grep javajdk
rpm -e --nodeps java-1.8.0-openjdk-1.8.0.102-4.b14.el7.x86_64file