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
:
- Will performing a
yum install
on 1.1 after 1.0 is already installed, list 2 packages? - Will running
yum update some-package-1.1
successfully replacesome-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. Thoughrpm
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 asyum 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.And I'm currently at this version:
When we try to install it:
So in summary
No. YUM will still perform an update even when you've told it to do an install if the package is already installed.
Yes.