Yum and RPM

Table of Contents


List contents of RPM

rpm -qlp package.rpm

List files (already) installed by package

rpm --query --filesbypkg package

List all installed packages

rpm -qa

List installed packages by date

rpm -qa --queryformat '%{installtime} (%{installtime:date}) %{name} %{version}\n' | sort -n | less

List installed packages by date on remote host

ssh user@remotehost "rpm -qa --queryformat '%{installtime} (%{installtime:date}) %{name} %{version}\n' | sort -n"

Check which package installed a file

rpm -qf /path/to/file

RHN Licence Check

less /etc/sysconfig/rhn/systemid

Verifying files on disk to files in package.

rpm -V net-snmp

.. lists files like this:

S.5....T.  c /etc/snmp/snmpd.conf
• S is the file size.
• M is the file's mode.
• 5 is the MD5 checksum of the file.
• D is the file's major and minor numbers.
• L is the file's symbolic link contents.
• U is owner of the file.
• G is the file's group.
• T is the modification time of the file.
• c appears only if the file is a configuration file. This is handy for quickly identifying config files, as they are very likely to change, and therefore, very unlikely to verify successfully.
• <file> is the file that failed verification. The complete path is listed to make it easy to find.


Which package provided a given file

yum provides /path/to/file

List files in RPM package using YUM - with repoquery in yum-tools

yum install yum-utilsrpm
repoquery -lq mlocate

Restore original config from package.

Remove config and run

yum reinstall net-snmp

to restore original. Otherwise it will install it as filename.rpmnew

Author: Rói á Torkilsheyggi

Created: 2015-12-16 Wed 01:39

Emacs 24.5.1 (Org mode 8.2.10)