4

I've realized that for some commands like wget and dig, we need to use the command yum to install them before we can use them.

Doing some research the dig command doesn't come installed for security purposes and for it's installation we can run the following command: yum install bind-utils which is a package that comes with dig.

So my question's are:

  • what if I don't want the dig command anymore, how do I get rid of it?
  • Is there an uninstall command I can use?
1
  • Have you tried removing it with yum? yum remove bind-utils
    – BriGuy
    Mar 18, 2014 at 20:26

3 Answers 3

5

There are 2 methods for installing and removing packages on Red Hat based distros such as CentOS, Fedora, or RHEL. Often times newcomers are confused by what looks to be duplicate commands but these 2 commands are complimentary and should be used as follows.

When installing & removing packages you should 95% of the time use yum to do the heavy lifting. So to install a package:

$ yum install <package>

To remove a package:

$ yum remove <package>

So then the question becomes, what package does a given file belong to? To determine this you can use the command type to programmatically figure this out.

$ type -p dig
/usr/bin/dig

To determine what RPM package a given file belongs to you can use rpm to query the system's RPM database like so for this:

$ rpm -qf /usr/bin/dig
bind-utils-9.3.6-20.P1.el5_8.6

So you can get fancy and do the type command along with the rpm command in a one liner like this:

$ rpm -qf $(type -p dig)
bind-utils-9.3.6-20.P1.el5_8.6

So why can't I just use RPM to install and remove?

It's true that you can make use of rpm's erase switch, -e to remove a package but I often encourage new comers to use yum because yum has a more high level perspective of the system and can determine if the removal of a given package will impact other packages, and yum can also remove other unnecessary packages when you direct it to remove a given package if they're no longer required.

NOTE So the bottom line is yum is just smarter about package management then rpm.

Is removing these a "good thing"?

Since this packages was optionally installed after your system was setup/installed its removal is not a big deal. However I'd caution you about removing packages that you don't fully understand their role, especially packages such as this one where there are several tools included, and not just one.

Often times there are a suite of command line tools that are included in a package that will typically go unused, meanwhile some other tool in the suite is used either by you constantly or by other tools/scripts/cronjobs constantly.

The removal of such tools can lead to annoying breakages for you and generally just wastes your time, so I'd encourage you to just leave these packages installed.

4

yum is "just" a package manager over the rpm package system. So if you want to remove an installed package yum remove is the answer (or in some extreme cases rpm -e).

To get the complete name of the package owning the dig command (the package version is just an example from a CentOS 5.8):

$ rpm -qf $(type -p dig)
bind-utils-9.3.6-20.P1.el5

Then you can remove this package using:

$ yum remove bind-utils-9.3.6-20.P1.el5

If you want to known more about rpm or yum: man rpm or man yum.

WARNING: If not mandatory, this package still contains some very useful DNS related utilities like host:

$ rpm -ql bind-utils-9.3.6-20.P1.el5
/usr/bin/dig
/usr/bin/host
/usr/bin/nslookup
/usr/bin/nsupdate
/usr/share/man/man1/dig.1.gz
/usr/share/man/man1/host.1.gz
/usr/share/man/man1/nslookup.1.gz
/usr/share/man/man1/nsupdate.1.gz
2
  • No, using naked rpm is almost never the answer. It doesn't manage dependencies, just one package at a time.
    – vonbrand
    Mar 19, 2014 at 2:47
  • Ok, yum is more high level, but rpm would not go over dependencies (in that case tog-pegasus).
    – Ouki
    Mar 19, 2014 at 9:05
1

Just use:

yum remove packagename

This should get rid of any package that was installed with yum. So in your case, run:

yum remove bind-utils

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .