centos7卸载openjdk-java11

[root@localhost ~]# rpm -qa|grep -i openjdk
java-11-openjdk-headless-11.0.23.0.9-2.el7_9.x86_64
java-11-openjdk-devel-11.0.23.0.9-2.el7_9.x86_64
java-11-openjdk-11.0.23.0.9-2.el7_9.x86_64

# 卸载命令, yum remove 会同时卸下该包及其不再被其它已安装包依赖的包。若想同时卸掉运行时包,可一起写 yum remove -y java-11-openjdk-devel java-11-openjdk
[root@localhost ~]# yum deplist java-11-openjdk-devel
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                                                                                                                                                                      | 3.6 kB  00:00:00     
extras                                                                                                                                                                                                                    | 2.9 kB  00:00:00     
jenkins                                                                                                                                                                                                                   | 2.9 kB  00:00:00     
updates                                                                                                                                                                                                                   | 2.9 kB  00:00:00     
jenkins/primary_db   
.............
Warning: RPMDB altered outside of yum.
  Erasing    : 1:java-11-openjdk-devel-11.0.23.0.9-2.el7_9.x86_64                                                                                                                                                                            1/2 
  Erasing    : 1:java-11-openjdk-11.0.23.0.9-2.el7_9.x86_64                                                                                                                                                                                  2/2 
  Verifying  : 1:java-11-openjdk-11.0.23.0.9-2.el7_9.x86_64                                                                                                                                                                                  1/2 
  Verifying  : 1:java-11-openjdk-devel-11.0.23.0.9-2.el7_9.x86_64                                                                                                                                                                            2/2 

Removed:
  java-11-openjdk.x86_64 1:11.0.23.0.9-2.el7_9                                                                         java-11-openjdk-devel.x86_64 1:11.0.23.0.9-2.el7_9                                                                        

Complete!


  • 卸载后检查
[root@localhost ~]# yum list installed | grep java 
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
java-11-openjdk-headless.x86_64         1:11.0.23.0.9-2.el7_9          @updates 
javapackages-tools.noarch               3.4.1-11.el7                   @base    
python-javapackages.noarch              3.4.1-11.el7                   @base    
tzdata-java.noarch                      2024a-1.el7                    @updates 
[root@localhost ~]# yum remove -y java-11*
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Resolving Dependencies
--> Running transaction check
---> Package java-11-openjdk-headless.x86_64 1:11.0.23.0.9-2.el7_9 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

[root@localhost ~]# java -version
-bash: /usr/bin/java: No such file or directory

posted @ 2025-09-19 10:22  codetodo  阅读(13)  评论(0)    收藏  举报