How to Reinstall a Package with YUM

In the event that something happens to the software you have installed on your server, you may need to reinstall it. YUM, the package manager for Red Hat Enterprise Linux, Fedora, and CentOS, allows you to reinstall packages whenever necessary.

To reinstall a package with YUM, do the following:

# yum reinstall name-of-package

YUM will prompt you before proceeding

Reinstall 1 Package(s)

Total download size: 147 k

Installed size: 380 k

Is this ok [y/N]: y

Type in “y” and press Enter. YUM will then reinstall your package the way that it was meant to be originally, even if you had previously deleted or altered crucial files.

Assuming all goes well, any of the changes to system files will be overwritten by the reinstallation. It is important to note here, however, that not all files will be overwritten in a reinstall. If you have specific local configuration files, the reinstallation may or may not affect them. If that is what you need to fix, the best course of action may be to remove the offending configuration files from their directories. In most cases, non-local configuration files (such as those in /etc) will not be saved after a “yum remove” command.