I need to install a package that is missing in my virtual machine that is running Red Hat. How do I do that?

What command should I use to install/remove/upgrade .rpm packages?


EDIT: As recommended in a comment below, you can just use yum for everything and you will be fine.

Check Red Hat's documentation for the rpm command.


  • rpm -Uvh package_file.rpm installs/upgrades a package from a .rpm file
  • rpm -e package_name removes a package

To install packages from Red Hat's repositories, use yum, whose commands are mostly self-explanatory (install, update etc...). This documentation is for CentOS 5, but I think it should work for newer versions of Red Hat/CentOS.

  • 8
    As this page of the RHEL6 Deployment Guide explains, you should only use rpm if absolutely necessary -- under normal circumstances, there's no reason to use the above-mentioned rpm commands to play with the package database; yum install package_file.rpm and yum remove package_name will do just fine. – rsaw Jul 15 '12 at 19:37
  • @ryran sweet, I didn't know that (haven't used rpm-based distros in quite a while). Edited my answer to reflect that. – Renan Jul 15 '12 at 20:24

RTFM: man yum. apropos install leads to the rights track.

If "apropos" does not return anything, you have to run makewhatis first.

After that you will find almost anything with "apropos" which will do a full-text-search of all man-page-short-descriptions.

yum, as opposed to rpm, will resolve all dependencies needed.

  • For the record, apropos only searches the names and short descriptions of man pages, in contrast to what you describe. man -K on the other hand... – rsaw Jul 16 '12 at 0:21
  • @ryran thanks - I corrected it. On CentOS 5 man -k does the same as apropos, according to the man-page and to a test. – Nils Jul 17 '12 at 15:23

Install Rpm

rpm -ivh abcd.rpm

Update rpm

rpm -Uvh abcdef.rpm

remove rpm

rpm -e abcd.rpm 

or remove the the rpm without deps

rpm -e --nodeps abcd.rpm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.