1.创建存放JDK目录,上传JDK压缩包
我是再usr下边创建一个Java的目录存放JDK的
mkdir Java
把JDK传到usr/java
解压:tar -zxvf jdk1.8.0_121-linux-x64.tar.gz
2.设置环境变量
vim /etc/profile
添加在文件最前边:
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_121
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
3.运行profile文件
source /etc/profile
4.检查安装的JDK
java -version /java/javadoc
5.卸载JDK
rpm -e –nodeps tzdata-java-2016g-2.el7.noarch
rpm -e –nodeps java-1.7.0-openjdk-1.7.0.111-2.6.7.8.el7.x86_64
rpm -e –nodeps java-1.7.0-openjdk-headless-1.7.0.111-2.6.7.8.el7.x86_64
rpm -e –nodeps java-1.8.0-openjdk-1.8.0.102-4.b14.el7.x86_64
rpm -e –nodeps java-1.8.0-openjdk-headless-1.8.0.102-4.b14.el7.x86_64
或 yum remove *openjdk*
6.输入rpm -qa | grep java 查看卸载情况
rpm -qa | grep java
python-javapackages-3.4.1-11.el7.noarch
javapackages-tools-3.4.1-11.el7.noarch
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/tech/aiops/1538.html