User Tools

Site Tools


yum_rpm_handling

RPM handling

List query tags

rpm --querytags

List package that provide file

rpm -q --whatprovides <filename>
Example:
rpm -q --whatprovides /usr/bin/lsscsi
lsscsi-0.23-2.el6.x86_64

List files provided by installed rpm package

rpm -ql *package*

List files provided by rpm package placed in current folder

rpm -qlp *package*

List scripts provided by installed rpm package

rpm -q --scripts *package*

List scripts provided by rpm package placed in current folder

rpm -qp --scripts *package*

List package vendors

List packages from 3 party vendors (Not Red Hat).

 rpm -qa --qf '%{NAME} %{VENDOR}\n' | grep -v "Red Hat, Inc."
 

List package GPG signatures

rpm -qa --qf '%{NAME} %{SIGGPG:pgpsig} %{SIGPGP:pgpsig} \n' 
 

Query Package Install Order and Dates

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

Show all installed public GPG keys

rpm -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n' 

Remove installed public GPG key

rpm -e --allmatches gpg-pubkey-<pub signature>

List public GPG key included in signed RPM package

rpm -Kv <RPM package>
rpm -Kv zsh-4.3.10-4.1.el6.x86_64.rpm
zsh-4.3.10-4.1.el6.x86_64.rpm:
  Header V3 RSA/SHA256 Signature, key ID fd431d51: OK
  Header SHA1 digest: OK (65b8120096b3ffdec9f34767883a7e343442b388)
  V3 RSA/SHA256 Signature, key ID fd431d51: OK
  MD5 digest: OK (0fd7878f63df3b48b5d0099ea9c81717)

If the RPM package is not signed the output will be missing the SHA/RSA signatures.

rpm -Kv TIVsm-API64.x86_64.rpm
  TIVsm-API64.x86_64.rpm:
  Header SHA1 digest: OK (07dad9f7be72b5a322c355038589b75dbf5038b6)
  MD5 digest: OK (67ae54c20e4195c48bb3c7a90b7655db)

The SHA1 & MD5 digest information is the cheksums.

Sign RPM package

rpm --addsign <RPM package>

Show verbose information about RPM package

rpm -qip <package.rpm>
rpm -qip zsh-4.3.10-4.1.el6.x86_64.rpm
Name        : zsh                          Relocations: (not relocatable)
Version     : 4.3.10                            Vendor: Red Hat, Inc.
Release     : 4.1.el6                       Build Date: Tue 08 Dec 2009 09:35:26 PM CET
Install Date: (not installed)               Build Host: ls20-bc2-13.build.redhat.com
Group       : System Environment/Shells     Source RPM: zsh-4.3.10-4.1.el6.src.rpm
Size        : 5011302                          License: BSD
Signature   : RSA/8, Mon 16 Aug 2010 10:35:42 PM CEST, Key ID 199e2f91fd431d51
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
URL         : http://zsh.sunsite.dk/
Summary     : A powerful interactive shell
Description :
The zsh shell is a command interpreter usable as an interactive login
shell and as a shell script command processor.  Zsh resembles the ksh
shell (the Korn shell), but includes many enhancements.  Zsh supports
command line editing, built-in spelling correction, programmable
command completion, shell functions (with autoloading), a history
mechanism, and more.

Show verbose information about installed rpm package

rpm -qi *package*

Extract files from RPM package

rpm2cpio httpd-2.2.3-31.el5_4.2.x86_64.rpm | cpio -idmv

Extract just one file from RPM package

rpm2cpio logrotate-1.0-1.i386.rpm |cpio -ivd etc/logrotate.conf

Yum handling

Query Available Packages From Selected YUM Repository

yum --disablerepo="*" --enablerepo="google" list available

List files in rpm package available from repository

This applies to both installed packages and just available packages. Requires yum-utils.

repoquery -l *package*

List package denpendencies

yum deplist <package>

Only download packages

You might want to download packages without installing them.

Make sure yum-downloadonly plugin is installed

yum install yum-downloadonly

Update system but only download packages do not install them

yum update -y --downloadonly

Default download cache is /var/cache/yum/. This cn be overidden with –downloaddir option

Transaction Check Error

Getting conflict errors between 32bit and 64 bit packages when doing yum update

Transaction Check Error:

file blablabla from install of hal-0.5.8.1-62.el5.i386.rpm conflicts with file from package hal-0.5.8.1-62.el5.x64.rpm

rpm -Uvh --force /var/cache/yum/rhel-x86_64-server-5/packages/hal-0.5.8.1-62.el5.i386.rpm

Now re-run yum update. Now everything works fine.

yum_rpm_handling.txt · Last modified: 2013/09/27 10:55 by root