如何卸载rpm包

Posted wuling129

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何卸载rpm包相关的知识,希望对你有一定的参考价值。

首先通过  rpm -q <关键字> 可以查询到rpm包的名字

然后 调用 rpm -e <包的名字> 删除特定rpm包

如果遇到依赖,无法删除,使用 rpm -e --nodeps <包的名字> 不检查依赖,直接删除rpm包

如果恰好有多个包叫同样的名字,使用 rpm -e --allmatches --nodeps <包的名字> 删除所有相同名字的包, 并忽略依赖

删除 mysql5.6示例

[[email protected] Downloads]$ rpm -qa|grep mysql
mysql-community-client-5.6.27-2.el6.x86_64
mysql-community-libs-5.6.27-2.el6.x86_64
php-mysql-5.3.3-46.el6_6.x86_64
mysql-community-common-5.6.27-2.el6.x86_64
mysql-community-libs-compat-5.6.27-2.el6.x86_64
mysql-community-server-5.6.27-2.el6.x86_64
mysql-community-release-el6-5.noarch
[wuliang@localhost Downloads]$ yum -y remove mysql

[root@localhost Downloads]# rpm -qa|grep mysql
mysql-community-libs-5.6.27-2.el6.x86_64
php-mysql-5.3.3-46.el6_6.x86_64
mysql-community-common-5.6.27-2.el6.x86_64
mysql-community-libs-compat-5.6.27-2.el6.x86_64
mysql-community-release-el6-5.noarch

[root@localhost Downloads]# rpm -e mysql-community-libs-5.6.27-2.el6.x86_64
error: Failed dependencies:
    mysql-community-libs(x86-64) = 5.6.27-2.el6 is needed by (installed) mysql-community-libs-compat-5.6.27-2.el6.x86_64
[root@localhost Downloads]# rpm -e mysql-community-libs-compat-5.6.27-2.el6.x86_64
error: Failed dependencies:
    libmysqlclient.so.16()(64bit) is needed by (installed) php-mysql-5.3.3-46.el6_6.x86_64
    libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) php-mysql-5.3.3-46.el6_6.x86_64
[root@localhost Downloads]# rpm -e php-mysql-5.3.3-46.el6_6.x86_64
[[email protected] Downloads]# rpm -e mysql-community-libs-compat-5.6.27-2.el6.x86_64
[[email protected] Downloads]# rpm -e mysql-community-libs-5.6.27-2.el6.x86_64
[[email protected] Downloads]# rpm -q|grep mysql
rpm: no arguments given for query
[root@localhost Downloads]# rpm -qa|grep mysql
mysql-community-common-5.6.27-2.el6.x86_64
mysql-community-release-el6-5.noarch
[root@localhost Downloads]# rpm -e mysql-community-release-el6-5.noarch
[[email protected] Downloads]# rpm -e mysql-community-common-5.6.27-2.el6.x86_64
[[email protected] Downloads]# rpm -qa|grep mysql
没有了  说明删除干净

 

以上是关于如何卸载rpm包的主要内容,如果未能解决你的问题,请参考以下文章

RPM卸载软件包

Linux rpm -e卸载命令e是哪个单词

CentOS7下rpm命令详解,rpm包的安装与卸载

linux中如何卸载mysql 在线急等 我的是源码安装包 不是RPM的 在centos上装的 我想完全卸载掉 急求 加分

RPM命令详解(安装升级卸载)

在Centos5.5中,如何卸载源码包安装的php