20

While working with the rpm command I noticed that if I installed some-package-1.0 and then performed another rpm -ivh some-package-1.1 both packages will be listed when I do a rpm -qa | grep some-package like the following:

some-package-1.0
some-package-1.1

However instead of installing 1.1, if I upgrade via the rpm -Uvh some-package-1.1 I get the desired result of a single package (1.1) when I do rpm -qa | grep some-package.

Now does the same behavior apply with yum install and yum update?

I ask because with the rpm -U (upgrade) command a package doesn't have to exist to upgrade/install but with yum update (if I'm not mistaken) a package must already exist.

I'm particularly interested to know the result of specifying packages with their versions such as some-package-1.0. So in summation, what I want to know is if I have two specific versions such as some-package-1.0 and some-package-1.1:

  1. Will performing a yum install on 1.1 after 1.0 is already installed, list 2 packages?
  2. Will running yum update some-package-1.1 successfully replace some-package-1.0?
31

The major differences between YUM and RPM are that yum knows how to resolve dependencies and can source these additional packages when doing its work. Though rpm can alert you to these dependencies, it is unable to source additional packages.

As to installing vs. upgrading. Both tools can perform an install, and RPM will even allow you to install multiple versions simultaneously, but YUM will tell you that that package is already installed. So no YUM will not allow you to install multiple versions.

As to yum update, this will react in one of two ways. If you tell it a package that you want to update, it will attempt to do so, downloading all the necessary dependencies and installing them too. If you run it without any package name, yum update will attempt to update every package that's installed on your system.

If you use yum upgrade it will do the same as yum update, except it will attempt to remove any packages that have been marked as "obsolete".

Example

Here's a scenario not unlike your own. A new version of vim-X11 is available.

$ yum check-update vim-X11 | expand
Loaded plugins: auto-update-debuginfo, changelog, langpacks, refresh-packagekit

vim-X11.x86_64                     2:7.4.417-1.fc19                      updates

And I'm currently at this version:

$ rpm -q vim-X11 | expand
vim-X11-7.4.179-1.fc19.x86_64

When we try to install it:

$ sudo yum install vim-X11
...   
=================================================================================================================================================================
 Package                                 Arch                              Version                                      Repository                          Size
=================================================================================================================================================================
Updating:
 vim-X11                                 x86_64                            2:7.4.417-1.fc19                             updates                            1.2 M
Updating for dependencies:
 vim-common                              x86_64                            2:7.4.417-1.fc19                             updates                            5.9 M
 vim-enhanced                            x86_64                            2:7.4.417-1.fc19                             updates                            1.0 M
....
Running transaction
  Updating   : 2:vim-common-7.4.417-1.fc19.x86_64                                                                                                            1/6 
  Updating   : 2:vim-enhanced-7.4.417-1.fc19.x86_64                                                                                                          2/6 
  Updating   : 2:vim-X11-7.4.417-1.fc19.x86_64                                                                                                               3/6 
  Cleanup    : 2:vim-X11-7.4.179-1.fc19.x86_64                                                                                                               4/6 
  Cleanup    : 2:vim-enhanced-7.4.179-1.fc19.x86_64                                                                                                          5/6 
  Cleanup    : 2:vim-common-7.4.179-1.fc19.x86_64                                                                                                            6/6 
  Verifying  : 2:vim-enhanced-7.4.417-1.fc19.x86_64                                                                                                          1/6 
  Verifying  : 2:vim-X11-7.4.417-1.fc19.x86_64                                                                                                               2/6 
  Verifying  : 2:vim-common-7.4.417-1.fc19.x86_64                                                                                                            3/6 
  Verifying  : 2:vim-enhanced-7.4.179-1.fc19.x86_64                                                                                                          4/6 
  Verifying  : 2:vim-X11-7.4.179-1.fc19.x86_64                                                                                                               5/6 
  Verifying  : 2:vim-common-7.4.179-1.fc19.x86_64                                                                                                            6/6 

So in summary

  1. Will performing a yum install on 1.1 after 1.0 is already installed, list 2 packages?

No. YUM will still perform an update even when you've told it to do an install if the package is already installed.

  1. Will running yum update some-package-1.1 successfully replace some-package-1.0 ?

Yes.

  • Thanks for the much detailed answer. So the way I see it I can just continue to use yum install when I specify package name with version and not be concerned with it installing multiple versions. A situation where I would want to use yum update would be when I only specify the package name, correct? – kaizenCoder Sep 25 '14 at 22:43
  • @aspiringCodeArtisan - that's partially correct. yum install will detect that a package is already installed and will switch to updating it vs. installing it, as my example showed. – slm Sep 25 '14 at 22:53
  • @slm - To clarify, can rpm search a repository similar to zypper search for a particular package? – Motivated Jan 17 at 4:00
  • 1
    @Motivated - no rpm is like dpkg, it only concerns itself w/ managing the files on the local disk. For repository "management" b/w your system + a repo you need something like yum or dnf. – slm Jan 17 at 13:12
  • 1
    @Motivated - rpm when used to install from a url doesn't do any package dep to pull them in too, it merely downloads the rpm locally and then installs it. – slm Jan 17 at 17:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.