如何卸载rpm包

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

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

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

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

删除 mysql5.6示例

[wuliang@localhost 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
[root@localhost Downloads]# rpm -e mysql-community-libs-compat-5.6.27-2.el6.x86_64
[root@localhost Downloads]# rpm -e mysql-community-libs-5.6.27-2.el6.x86_64
[root@localhost 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
[root@localhost Downloads]# rpm -e mysql-community-common-5.6.27-2.el6.x86_64
[root@localhost Downloads]# rpm -qa|grep mysql
没有了  说明删除干净

 

posted @ 2016-03-11 11:52  wuling129  阅读(5678)  评论(0编辑  收藏  举报