Update yum package using localinstall

14,555

Solution 1

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.

Solution 2

I prefer using the same pkg manager for everything now that there repo-based package managers.

It doesn't appear to be documented but indeed works w/ the standard yum args:

yum -y localupdate some-package-2.0.0.rpm

Share:
14,555
mbhargav294
Author by

mbhargav294

Updated on June 14, 2022

Comments

  • mbhargav294
    mbhargav294 almost 2 years

    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?

  • Jeter-work
    Jeter-work about 5 years
    Thank you for this excellent answer. The first part is an extremely good reason to avoid -y. Reviewing what YUM says it is going to do is a good way to prevent accidental misconfigurations.