rpm + how to identify if some rpm was removed or was not installed when installing the OS

Solution 1:

You can use yum history to find detailed information about a package installation, upgrade, or removal.

yum history list <package> will give a summary and yum history info <package> will give very detailed information.

For example:

[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

If more details are needed:

[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

You can also specify the ID number of a transaction you are interested in, e.g. yum history info 7