Linux中删除jdk包

1.显示jdk安装的版本
- 使用命令:rpm -qa |grep java
- rpm -e --nodeps [上述命令显示的jdk版本号]
- 这里的 –nodeps是“在删除jdk之前,不做包依赖的检查”。可以通过man rpm来查看具体的命令参数
2.删除jdk包
- rm -rf [包名]

Linux中安装jdk包

1.下载jdk的tar包
2.解压到某一路径,如使用命令:tar -zxvf jdk-8u161-linux-x64.tar.gz -C /usr/local
3.然后配置环境变量:

  • vi /etc/profile
  • export JAVA_HOME=/usr/local/jdk1.8.0_161
  • export PATH=$PATH:$JAVA_HOME/bin
  • 输入java -version做测试,即可。
#================更新======================
  • (1)--nodeps Don’t do a dependency check before installing or upgrading a package使用这个参数真的要三思啊!!笔者在安装完ldap之后,感觉没有安装成功,删除了openldap,使用了这个命令导致yum底层的依赖包都被我删除了啊,泪奔!导致后续使用yum的时候报错:
[root@littlelawson ~]# yum install -y openldap-servers openldap-clients
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   libldap-2.4.so.2: cannot open shared object file: No such file or directory

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
2.6.6 (r266:84292, Nov 22 2013, 12:16:22) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)]

If you cannot solve this problem yourself, please go to 
the yum faq at:
  http://yum.baseurl.org/wiki/Faq

现在的我心凉凉啊!