centos5.4 的rpm命令精解

wisdomone1發表於2010-04-29
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包已經沒有了





來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-661604/,如需轉載,請註明出處,否則將追究法律責任。

相關文章