we installed the following rpm's via yum on redhat version 5
# rpm -qa --last | head -10
kernel-headers-2.6.18-408.el5 Wed May 18 13:33:59 2016
bind-utils-9.3.6-25.P1.el5_11.6 Wed May 18 13:33:59 2016
redhat-release-5Server-5.11.0.2 Wed May 18 13:33:58 2016
nss-3.19.1-4.el5_11 Wed May 18 13:33:58 2016
nspr-4.10.8-2.el5_11 Wed May 18 13:33:58 2016
bind-libs-9.3.6-25.P1.el5_11.6 Wed May 18 13:33:58 2016
kernel-2.6.18-409.el5 Wed May 18 04:13:58 2016
How can I tell if these RPMs were installed from scratch or just upgraded?
I try by rpm -qi
but from rpm -qi , we not get the info if rpm was installed from scratch or upgraded.
Secondly, if an rpm was upgraded then how can I downgrade it to the previous version?
example when I try to downgrade:
yum downgrade openssh-server-5.3p1-117.el6.x86_64
Loaded plugins: product-id, rhnplugin, security, subscription-manager
This system is receiving updates from RHN Classic or RHN Satellite.
Setting up Downgrade Process
Only Upgrade available on package: openssh-server-5.3p1-117.el6.x86_64
Nothing to do
yum list 'openssh-server'
Loaded plugins: product-id, rhnplugin, security, subscription-manager
This system is receiving updates from RHN Classic or RHN Satellite.
openssh-server.x86_64 5.3p1-117.el6
Available Packages
penssh-server.x86_64 5.3p1-118.1.el6_8
Apparently (no experience since I am not a
yum
user),yum
keeps a history of transactions, which you can list usingor
to get a list of transactons and then
which will tell you what was installed/updated etc
and you can undo transactions using
Purely based on the
rpm
commands, afaik there are no means to know whether an rpm was installed from scratch or updated. I don't know either whether yum keeps a version of all rpms it once installed. If not; there is no guarantee you can undo a certain transaction. Suppose package-1 was installed from the install cd (or any other repository that is not available anymore); then updated to package-2. Suppose you want to undo that update transaction; that would be only possible if you have package-1.rpm available; which is not always (and mostly not) the case.Suppose you want to downgrade an rpm; you can search (
yum search
; or rpm search or...) a lower version of the rpm you want and install that one. That will always work (supposing you have all the correct dependencies); usingyum
,rpm
or others.