How to install/remove/upgrade .rpm packages on Red Hat?

128,204

Solution 1

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.

Solution 2

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.

Solution 3

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
Share:
128,204

Related videos on Youtube

Zignd
Author by

Zignd

Updated on September 18, 2022

Comments

  • Zignd
    Zignd over 1 year

    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?

  • rsaw
    rsaw almost 12 years
    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.
  • Renan
    Renan almost 12 years
    @ryran sweet, I didn't know that (haven't used rpm-based distros in quite a while). Edited my answer to reflect that.
  • rsaw
    rsaw almost 12 years
    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...
  • Nils
    Nils almost 12 years
    @ryran thanks - I corrected it. On CentOS 5 man -k does the same as apropos, according to the man-page and to a test.