大网数据广告活动
服务器运维问答

How to verify if an rpm was installed from scratch or upgraded?

· 52CE 我爱测

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.…

问题原文

原帖链接 · dandan · CC BY-SA 3.0

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 

已采纳解答

原帖链接 · Chris Maes · CC BY-SA 3.0

Apparently (no experience since I am not a yum user), yum keeps a history of transactions, which you can list using

yum history

or

yum history list 

to get a list of transactons and then

yum history info <transaction id>

which will tell you what was installed/updated etc

and you can undo transactions using

yum history undo <transaction index>

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); using yum, rpm or others.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-05-18)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。