Newbie
Newbie

Reputation: 2825

How to reinstall rpm package?

I have installed a package from .rpm file and it is stored in /opt.

After some configuration I found that I need to reinstall the software. So I deleted the directory and attempted to reinstall the file with rpm -i XXX.rpm. But it tells me that package xxx is already installed.

How can I reinstall it?

Upvotes: 53

Views: 144688

Answers (4)

sarnold
sarnold

Reputation: 104050

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

More details are in the book.

Upvotes: 82

Laenka-Oss
Laenka-Oss

Reputation: 994

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

Upvotes: 21

Piotr Dobrogost
Piotr Dobrogost

Reputation: 42425

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.

Upvotes: 11

mohanjot
mohanjot

Reputation: 1510

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.

Upvotes: 1

Related Questions