How to reinstall rpm package?

Solution 1:

Try: rpm -iv --replacepkgs <packagefile>.

More details are in the book.

Solution 2:

You could also hit:

rpm -ivh --force [yourpackage.rpm]

which safely overwrites the old installed package with the desired new package. Furthermore, if you wish to install and upgrade simultaneously, then this next option:

rpm -Uvh [yourpackage.rpm]

will enable you to install including any upgrade simultaneously.

Another extra tip: You may face an error situation where an upgrade depends on another which in turn depends on another and inturn also depend on the one you want to install thus causing a "dependency upgrade loop". To avoid that hit:

rpm -Uvh --nodeps [yourpackage.rpm].

Solution 3:

Starting with version 4.12.0 there's --reinstall option.

From RPM 4.12.0 Release Notes:

New --reinstall mode which can handle changing file policies (RhBug:966715)

From man rpm:

rpm {--reinstall} [install-options] PACKAGE_FILE ...

This reinstalls a previously installed package.

Solution 4:

You got to uninstall the software's rpm:

rpm -e XXX.rpm

Then install it :

rpm -i XXX.rpm

Next time whenever you are not sure about the software being already there on the machine, always check using:

rpm -qa |grep XXX 

where XXX is the software name or part of the name. This will give you the version already present on the machine.