【Centos7】卸载OpenJDK
  mQjQKqi4ZH9Z 2023年11月02日 25 0


一般情况下,centos会自带OpenJDK,Hadoop的运行环境要求自己配置JRE,但在home下配置好了JRE后,使用java -version仍然看到OpenJDK,原因是系统根据$PATH路径,首先会在/usr/bin/中找到OpenJDK的java,并非我们自己配置的JDK。

解决办法有两种:1.配置/etc/profile使/home/xxx/jdk/bin首先被找到。2.卸载OpenJDK

这里推荐第二种

1.查看安装了哪些OpenJDK

[root@master1 bin]# rpm -qa | grep jdk

2.卸载OpenJDK

[root@master1 bin]# yum -y remove java-1.8.0-open*

3.这时在/usr/bin中已经没有java了

4.使用java -version看到了自己配置的JDK,这里已经成功卸载

[hadoop@master1 ~]$ java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)



5.这一步可以不看了,仅仅是通过卸载记录来研究OpenJDK的RPM包依赖关系

[oracle@hadoop ~]$ yum -y remove java-1.8.0-openjdk*
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
You need to be root to perform this command.
[oracle@hadoop ~]$ su
Password:
[root@hadoop oracle]# yum -y remove java-1.8.0-openjdk*
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Resolving Dependencies
--> Running transaction check
---> Package java-1.8.0-openjdk-headless.x86_64 1:1.8.0.111-2.b15.el7_3 will be erased
--> Processing Dependency: java-headless >= 1:1.6 for package: 1:libreoffice-core-5.0.6.2-3.el7.x86_64
--> Processing Dependency: libjvm.so()(64bit) for package: 1:libreoffice-ure-5.0.6.2-3.el7.x86_64
--> Running transaction check
---> Package libreoffice-core.x86_64 1:5.0.6.2-3.el7 will be erased
--> Processing Dependency: libavmedialo.so()(64bit) for package: 1:libreoffice-calc-5.0.6.2-3.el7.x86_64
---> Package libreoffice-ure.x86_64 1:5.0.6.2-3.el7 will be erased
--> Running transaction check
---> Package libreoffice-calc.x86_64 1:5.0.6.2-3.el7 will be erased
---> Package libreoffice-draw.x86_64 1:5.0.6.2-3.el7 will be erased
---> Package libreoffice-graphicfilter.x86_64 1:5.0.6.2-3.el7 will be erased
---> Package libreoffice-impress.x86_64 1:5.0.6.2-3.el7 will be erased
---> Package libreoffice-pdfimport.x86_64 1:5.0.6.2-3.el7 will be erased
---> Package libreoffice-pyuno.x86_64 1:5.0.6.2-3.el7 will be erased
---> Package libreoffice-writer.x86_64 1:5.0.6.2-3.el7 will be erased
---> Package unoconv.noarch 0:0.6-7.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository
Size
================================================================================
Removing:
java-1.8.0-openjdk-headless x86_64 1:1.8.0.111-2.b15.el7_3 @updates 102 M
Removing for dependencies:
libreoffice-calc x86_64 1:5.0.6.2-3.el7 @base 29 M
libreoffice-core x86_64 1:5.0.6.2-3.el7 @base 238 M
libreoffice-draw x86_64 1:5.0.6.2-3.el7 @base 2.2 M
libreoffice-graphicfilter x86_64 1:5.0.6.2-3.el7 @base 1.3 M
libreoffice-impress x86_64 1:5.0.6.2-3.el7 @base 4.8 M
libreoffice-pdfimport x86_64 1:5.0.6.2-3.el7 @base 545 k
libreoffice-pyuno x86_64 1:5.0.6.2-3.el7 @base 1.9 M
libreoffice-ure x86_64 1:5.0.6.2-3.el7 @base 6.8 M
libreoffice-writer x86_64 1:5.0.6.2-3.el7 @base 15 M
unoconv noarch 0.6-7.el7 @base 196 k

Transaction Summary
================================================================================
Remove 1 Package (+10 Dependent packages)

Installed size: 402 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : unoconv-0.6-7.el7.noarch 1/11
Erasing : 1:libreoffice-calc-5.0.6.2-3.el7.x86_64 2/11
Erasing : 1:libreoffice-impress-5.0.6.2-3.el7.x86_64 3/11
Erasing : 1:libreoffice-writer-5.0.6.2-3.el7.x86_64 4/11
Erasing : 1:libreoffice-draw-5.0.6.2-3.el7.x86_64 5/11
Erasing : 1:libreoffice-pdfimport-5.0.6.2-3.el7.x86_64 6/11
Erasing : 1:libreoffice-graphicfilter-5.0.6.2-3.el7.x86_64 7/11
Erasing : 1:libreoffice-pyuno-5.0.6.2-3.el7.x86_64 8/11
Erasing : 1:libreoffice-core-5.0.6.2-3.el7.x86_64 9/11
Erasing : 1:libreoffice-ure-5.0.6.2-3.el7.x86_64 10/11
Erasing : 1:java-1.8.0-openjdk-headless-1.8.0.111-2.b15.el7_3.x86_ 11/11
failed to read link /usr/bin/java: No such file or directory
Verifying : 1:libreoffice-writer-5.0.6.2-3.el7.x86_64 1/11
Verifying : 1:libreoffice-impress-5.0.6.2-3.el7.x86_64 2/11
Verifying : 1:libreoffice-pdfimport-5.0.6.2-3.el7.x86_64 3/11
Verifying : 1:libreoffice-core-5.0.6.2-3.el7.x86_64 4/11
Verifying : 1:libreoffice-calc-5.0.6.2-3.el7.x86_64 5/11
Verifying : 1:libreoffice-draw-5.0.6.2-3.el7.x86_64 6/11
Verifying : 1:libreoffice-graphicfilter-5.0.6.2-3.el7.x86_64 7/11
Verifying : 1:libreoffice-pyuno-5.0.6.2-3.el7.x86_64 8/11
Verifying : unoconv-0.6-7.el7.noarch 9/11
Verifying : 1:libreoffice-ure-5.0.6.2-3.el7.x86_64 10/11
Verifying : 1:java-1.8.0-openjdk-headless-1.8.0.111-2.b15.el7_3.x86_ 11/11

Removed:
java-1.8.0-openjdk-headless.x86_64 1:1.8.0.111-2.b15.el7_3

Dependency Removed:
libreoffice-calc.x86_64 1:5.0.6.2-3.el7
libreoffice-core.x86_64 1:5.0.6.2-3.el7
libreoffice-draw.x86_64 1:5.0.6.2-3.el7
libreoffice-graphicfilter.x86_64 1:5.0.6.2-3.el7
libreoffice-impress.x86_64 1:5.0.6.2-3.el7
libreoffice-pdfimport.x86_64 1:5.0.6.2-3.el7
libreoffice-pyuno.x86_64 1:5.0.6.2-3.el7
libreoffice-ure.x86_64 1:5.0.6.2-3.el7
libreoffice-writer.x86_64 1:5.0.6.2-3.el7
unoconv.noarch 0:0.6-7.el7

Complete!
[root@hadoop oracle]#

通过记录可以看出 libreoffice这个软件是基于JAVA的,卸载OpenJDK后,libreoffice就不能用了,节省了402M的磁盘空间。



【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
  sX9JkgY3DY86   2023年11月13日   43   0   0 idesedImage
  sX9JkgY3DY86   2023年11月13日   46   0   0 idesedflutter
  sX9JkgY3DY86   2023年11月13日   41   0   0 ideTextsed
  sX9JkgY3DY86   2023年11月13日   37   0   0 Textsed
mQjQKqi4ZH9Z