17

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?

3 Answers 3

17

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.

Basically:

  • 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.

2
  • 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, 2012 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, 2012 at 20:24
3

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.

2
  • 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, 2012 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, 2012 at 15:23
2

Install rpm:

rpm -ivh abcd.rpm

Update rpm:

rpm -Uvh abcdef.rpm

Remove rpm:

rpm -e abcd.rpm 

or remove the rpm without dependencies:

rpm -e --nodeps abcd.rpm

You must log in to answer this question.

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