Tag Archives: rpm

Remove Linux package via RPM without removing dependencies

Yesterday, i’ve tried removing net-tools from my CentOS 5 installation. Luckily i didn’t press Yes like i always do. It seems that removal of net-tools will also remove a whole lot of other things seemingly unrelated to it.

Since i’m not really a RTFM guy, i’m more of a RTSO (Stack Overflow) guy, this is the gist of what i’m trying to do. For this example, let say you are trying to remove httpd (Apache)Before removing anything, search for the package first using :

rpm -qa | grep "httpd"

Change httpd to whatever package you’re trying to remove.

You will see a list of packages found  :

httpd-2.4.6-80.el7.centos.x86_64
httpd-devel-2.4.6-80.el7.centos.x86_64
httpd-tools-2.4.6-80.el7.centos.x86_64

To remove a package, just type:

rpm -e httpd-devel-2.4.6-80.el7.centos.x86_64

This will remove httpd-devel. If you just want to remove httpd-devel without removing its dependencies, add –nodeps as such:

rpm -e httpd-devel-2.4.6-80.el7.centos.x86_64 --nodeps

By adding –nodeps flagthis will tell rpm to remove only httpd-devel and ignore its dependencies.

If, you are encountering “Specifies Multiple Packages” error, use this:

rpm -e httpd-devel-2.4.6-80.el7.centos.x86_64 --nodeps --allmatches

This will actually remove all packages using the same name. This multiple packages however can be earlier detected when you are using rpm -qa before doing rpm -e. 

That’s all for now. Adios.