LINUX删除或卸载已安装好的RPM包

1,现实情况往往是你想删除或卸载已安装好的软件。但你可能只知道这个软件安装好后的文件名是什么,此时可以先用which或其find找到你想删除的文件
[root@localhost rpm]# which httpd  ---查删除的文件
/usr/sbin/httpd
[root@localhost rpm]# rpm -q -f /usr/sbin/httpd  --根据文件查出所对应的rpm包名
httpd-2.2.3-31.el5.centos
[root@localhost rpm]# rpm -e httpd-2.2.3-31.el5.centos  --执行删除
error: Failed dependencies: --会报错,这说明会有依赖关系存在
        httpd-mmn = 20051115 is needed by (installed) php-5.1.6-23.2.el5_3.i386
        httpd-mmn = 20051115 is needed by (installed) mod_python-3.2.8-3.1.i386
        httpd-mmn = 20051115 is needed by (installed) mod_ssl-2.2.3-31.el5.centos.i386
        httpd-mmn = 20051115 is needed by (installed) mod_perl-2.0.4-6.el5.i386
        webserver is needed by (installed) webalizer-2.01_10-30.1.i386
        httpd is needed by (installed) piranha-0.8.4-13.el5.i386
        httpd >= 2.0.40 is needed by (installed) mod_python-3.2.8-3.1.i386
        httpd = 0:2.2.3-31.el5.centos is needed by (installed) mod_ssl-2.2.3-31.el5.centos.i386
        httpd = 2.2.3-31.el5.centos is needed by (installed) httpd-manual-2.2.3-31.el5.centos.i386
        httpd >= 2.2.0 is needed by (installed) gnome-user-share-0.10-6.el5.i386
        httpd is needed by (installed) system-config-httpd-1.3.3.3-1.el5.noarch
[root@localhost rpm]# rpm -e --allmatches httpd-2.2.3-31.el5.centos
error: Failed dependencies:
        httpd-mmn = 20051115 is needed by (installed) php-5.1.6-23.2.el5_3.i386
        httpd-mmn = 20051115 is needed by (installed) mod_python-3.2.8-3.1.i386
        httpd-mmn = 20051115 is needed by (installed) mod_ssl-2.2.3-31.el5.centos.i386
        httpd-mmn = 20051115 is needed by (installed) mod_perl-2.0.4-6.el5.i386
        webserver is needed by (installed) webalizer-2.01_10-30.1.i386
        httpd is needed by (installed) piranha-0.8.4-13.el5.i386
        httpd >= 2.0.40 is needed by (installed) mod_python-3.2.8-3.1.i386
        httpd = 0:2.2.3-31.el5.centos is needed by (installed) mod_ssl-2.2.3-31.el5.centos.i386
        httpd = 2.2.3-31.el5.centos is needed by (installed) httpd-manual-2.2.3-31.el5.centos.i386
        httpd >= 2.2.0 is needed by (installed) gnome-user-share-0.10-6.el5.i386
        httpd is needed by (installed) system-config-httpd-1.3.3.3-1.el5.noarch




-----加上删除一些选项,--allmatches是把与这个rpm包所有相匹配的rpm包全部删除掉;--nodeps是在删除时不进行依赖性的读取
[root@localhost rpm]# rpm -e --allmatches --nodeps httpd-2.2.3-31.el5.centos
[root@localhost rpm]# which httpd  ---再次查询,已经安装的rpm包已经没有了
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值