Difference between yum update vs yum install

rpmyum

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?

Best Answer

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.

Related Question