Linux

rpm + 如何在安裝作業系統時辨識某些 rpm 是否已刪除或未安裝

  • November 27, 2020

我們有 rhel 7.6 機器

我們注意到機器上沒有安裝一些特定的 rpm

問題是我們不確定是否有人將其yum remove刪除rpm -i

或者

只是從頭開始安裝作業系統時沒有從頭開始安裝 rpm

如果 rpm 未隨 OS 安裝一起安裝,我們將如何做的任何建議

或 rpm 被某人刪除?

您可以使用它yum history來查找有關軟體包安裝、升級或刪除的詳細資訊。

yum history list <package>會給出一個總結,並yum history info <package>會給出非常詳細的資訊。

例如:

[root@vmtest-centos7 ~]# yum history list htop
Loaded plugins: fastestmirror
ID     | Command line             | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
    7 | -d 2 -y install tmux tra | 2019-12-04 03:33 | I, U           |   49   
history list

如果需要更多詳細資訊:

[root@vmtest-centos7 ~]# yum history info htop
Loaded plugins: fastestmirror
Transaction ID : 7
Begin time     : Wed Dec  4 03:33:25 2019
Begin rpmdb    : 307:6c41312854623ca5d949e51faa4fef289e20f91d
End time       :            03:33:42 2019 (17 seconds)
End rpmdb      : 355:8d69d977579cbfe95784e897827e8897b00a5260
User           :  <ansible>
Return-Code    : Success
Command Line   : -d 2 -y install tmux traceroute wget vim-enhanced psmisc bind-utils unzip lsof pv bzip2 htop bash-completion tar epel-release rsyslog
Transaction performed with:
   Updated       rpm-4.11.3-40.el7.x86_64                      @anaconda
   Updated       yum-3.4.3-163.el7.centos.noarch               @anaconda
   Updated       yum-plugin-fastestmirror-1.1.31-52.el7.noarch @anaconda
Packages Altered:
   Dep-Install GeoIP-1.5.0-14.el7.x86_64                  @base
   Install     bash-completion-1:2.1-6.el7.noarch         @base
   Dep-Install bind-libs-32:9.11.4-9.P2.el7.x86_64        @base
   Dep-Install bind-libs-lite-32:9.11.4-9.P2.el7.x86_64   @base
   Dep-Install bind-license-32:9.11.4-9.P2.el7.noarch     @base
   Install     bind-utils-32:9.11.4-9.P2.el7.x86_64       @base
   Install     bzip2-1.0.6-13.el7.x86_64                  @base
   Updated     epel-release-7-11.noarch                   @extras
   Update                   7-12.noarch                   @epel
   Dep-Install geoipupdate-2.5.0-1.el7.x86_64             @base
   Dep-Install gpm-libs-1.20.7-6.el7.x86_64               @base
   Install     htop-2.2.0-3.el7.x86_64                    @epel
   Dep-Install libevent-2.0.21-4.el7.x86_64               @base
   Install     lsof-4.87-6.el7.x86_64                     @base
   Dep-Install perl-4:5.16.3-294.el7_6.x86_64             @base
   Dep-Install perl-Carp-1.26-244.el7.noarch              @base
   Dep-Install perl-Encode-2.51-7.el7.x86_64              @base
   Dep-Install perl-Exporter-5.68-3.el7.noarch            @base
   Dep-Install perl-File-Path-2.09-2.el7.noarch           @base
   Dep-Install perl-File-Temp-0.23.01-3.el7.noarch        @base
   Dep-Install perl-Filter-1.49-3.el7.x86_64              @base
   Dep-Install perl-Getopt-Long-2.40-3.el7.noarch         @base
   Dep-Install perl-HTTP-Tiny-0.033-3.el7.noarch          @base
   Dep-Install perl-PathTools-3.40-5.el7.x86_64           @base
   Dep-Install perl-Pod-Escapes-1:1.04-294.el7_6.noarch   @base
   Dep-Install perl-Pod-Perldoc-3.20-4.el7.noarch         @base
   Dep-Install perl-Pod-Simple-1:3.28-4.el7.noarch        @base
   Dep-Install perl-Pod-Usage-1.63-3.el7.noarch           @base
   Dep-Install perl-Scalar-List-Utils-1.27-248.el7.x86_64 @base
   Dep-Install perl-Socket-2.010-4.el7.x86_64             @base
   Dep-Install perl-Storable-2.45-3.el7.x86_64            @base
   Dep-Install perl-Text-ParseWords-3.29-4.el7.noarch     @base
   Dep-Install perl-Time-HiRes-4:1.9725-3.el7.x86_64      @base
   Dep-Install perl-Time-Local-1.2300-2.el7.noarch        @base
   Dep-Install perl-constant-1.27-2.el7.noarch            @base
   Dep-Install perl-libs-4:5.16.3-294.el7_6.x86_64        @base
   Dep-Install perl-macros-4:5.16.3-294.el7_6.x86_64      @base
   Dep-Install perl-parent-1:0.225-244.el7.noarch         @base
   Dep-Install perl-podlators-2.5.1-3.el7.noarch          @base
   Dep-Install perl-threads-1.87-4.el7.x86_64             @base
   Dep-Install perl-threads-shared-1.43-6.el7.x86_64      @base
   Install     psmisc-22.20-16.el7.x86_64                 @base
   Install     pv-1.4.6-1.el7.x86_64                      @epel
   Install     tmux-1.8-4.el7.x86_64                      @base
   Install     traceroute-3:2.0.22-2.el7.x86_64           @base
   Install     unzip-6.0-20.el7.x86_64                    @base
   Dep-Install vim-common-2:7.4.629-6.el7.x86_64          @base
   Install     vim-enhanced-2:7.4.629-6.el7.x86_64        @base
   Dep-Install vim-filesystem-2:7.4.629-6.el7.x86_64      @base
   Install     wget-1.14-18.el7_6.1.x86_64                @base
history info

您還可以指定您感興趣的交易的 ID 號,例如yum history info 7

引用自:https://serverfault.com/questions/1044103