6

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?

mbhargav294
  • 389
  • 1
  • 3
  • 15
  • ' "yum localinstall" is deprecated because "yum install" now does exactly the same thing when given a path to an RPM file rather than just a package name. ' source: https://www.linuxquestions.org/questions/linux-software-2/yum-localinstall-question-4175598142/ – pzkpfw Nov 12 '19 at 08:03

2 Answers2

8

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.

iamauser
  • 11,119
  • 5
  • 34
  • 52
  • 1
    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. – Jeter-work Apr 10 '19 at 19:43
4

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

Pavman
  • 125
  • 7