How to compare rpm packages on two servers and find missing packages ?
Today in this post, we will see how to compare rpm packages on two servers and find out the missing packages.
Lets look at it step by step.
1. Check out the rpm package count on one system.
[root@ngelinux1_dhcp ~]# rpm -qa | wc -l 3554 [root@ngelinux1_dhcp ~]#
2. Check out rpm package count on other system.
[root@ngelinux2_smb ~]# rpm -qa | wc -l 3534
3. Save the package list in one file on both systems.
[root@ngelinux2_smb ~]# rpm -qa | sort > /tmp/rpm_ngelinux2_smb [root@ngelinux2_smb ~]# [root@ngelinux1_dhcp ~]# rpm -qa | sort > /tmp/rpm_ngelinux1_dhcp [root@ngelinux1_dhcp ~]#
4. Now transfer one file to the other system and run below command.
[root@ngelinux03 ~]# diff -y --suppress-common-lines /tmp/rpm_ngelinux2_smb /tmp/rpm_ngelinux1_dhcp > dtk-scripts-6.1.2-3071.13314.el7.x86_64 > libsmbios-2.3.1-3071.13314.el7.x86_64 > libsmbiosc++-2.3.1-3071.13314.el7.x86_64 > raidcfg-6.1.2-3071.13314.el7.x86_64 > smbios-utils-bin-2.3.1-3071.13314.el7.x86_64 > srvadmin-argtable2-9.1.2-3071.13314.el7.x86_64 > srvadmin-deng-9.1.2-3071.13314.el7.x86_64 > srvadmin-deng-snmp-9.1.2-3071.13314.el7.x86_64 > srvadmin-hapi-9.1.2-3071.13314.el7.x86_64 > srvadmin-idracadm7-9.1.2-3071.13314.el7.x86_64 > srvadmin-idracadm-9.1.2-3071.13314.el7.x86_64 > srvadmin-isvc-9.1.2-3071.13314.el7.x86_64 > srvadmin-isvc-snmp-9.1.2-3071.13314.el7.x86_64 > srvadmin-omilcore-9.1.2-3071.13314.el7.x86_64 > srvadmin-racadm4-9.1.2-3071.13314.el7.x86_64 > srvadmin-racadm5-9.1.2-3071.13314.el7.x86_64 > srvadmin-smcommon-9.1.2-3071.13314.el7.x86_64 > srvadmin-storelib-9.1.2-3071.13314.el7.x86_64 > srvadmin-storelib-sysfs-9.1.2-3071.13314.el7.x86_64 > syscfg-6.1.2-3071.13314.el7.x86_64 [root@ngelinux03 ~]#
Hence on the second system, it doesn’t have these 20 packages installed.
Remember that we used sort command after the rpm list to get the clean output in diff command, otherwise the output is hard to understand.
In case there is some package extra on first system then we have that in first column available, however in my case none of that package available.