Update yum package using localinstall

mbhargav294 picture mbhargav294 · Feb 7, 2018 · Viewed 10.3k times · Source

If a package is installed using yum localinstall like this:

yum -y localinstall --nogpgcheck some-package-1.0.0.rpm

And now, if I try to run:

yum -y localinstall --nogpgcheck some-package-2.0.0.rpm

Will it replace the entire old version with the new one or does it maintain both the versions?

Answer

iamauser picture iamauser · Feb 8, 2018

Answer is, it depends on how some-package is packaged. In general, most of the .rpms packaged with foo-version-release.rpm gets obsoleted by the same package foo with version++ and/or release++.

Looking at your some-package, if you would run yum localinstall some-package-2.0.0.rpm (note, not with -y), then you would see message from yum, something like this:

Resolving Dependencies
--> Running transaction check
---> Package foo.x86_64 0:1.0.0 will be updated
---> Package foo.x86_64 0:2.0.0 will be an update

This tells that yum is going to update the package and remove the old one. yum resolves these dependencies whereas a rpm -ivh won't do it.

Now, there are special cases, e.g., kernel where it will be installed on the system side-by-side with the old one, unless you manual invoked a rpm -Uvh kernel*.rpm command.

Equivalent command to the yum localinstall would be two-fold,

# This will fail if some-2.0.0 is designed to obsolete some-1.0.0
$ rpm -ivh --test some-2.0.0.rpm  

whereas following would succeed:

$ rpm -Uvh --test some-2.0.0.rpm  

Note, I am using --test to do a dry-run. One needs to remove it for a real installation.