working with yum and rpm
download the latest repodata
yum clean
yum repolist
list current repos
yum repolist
Querying data from the RPM database
List the available tags
rpm --querytags
you can specify 1 or more tags plus what ever formatting you want /n /t etc..
rpm -q -qf "%{TAGNAME}\n" fake-rpm
or
rpm -q --qf "%{INSTALLTID}\n%{FILENAMES}\n%{BUILDTIME}\n" fake-rpm
determine which rpm has the largest file on the server
rpm -qa --queryformat "[%-15{NAME} %-50{FILENAMES} %{FILESIZES}\n]" | sort -n -k 3 | tail -20 # -k 3 = sort on thrid field
determine when an rpm was installed, displayed in human readable time
rpm -q --qf "%{NAME}-%{VERSION}-%{RELEASE} %{INSTALLTIME:date}\n" fake-rpm
fixing python on RHEL when someone breaks it
for i in `rpm -qa | grep python` ; do yum reinstall $i -y ; done
display a list of the last 10 rpms to be installed
rpm -q --all --last | head -10
determine inter dependencies
rpm -q --whatrequires /usr/lib/libstdc++.so.5
rpm -q --whatprovides /usr/lib/libstdc++.so.5
disable yum plugins on RHEL if your not registering the server with a satellite server
Resigning a vendor package with the your own GPG key
[root@server ~]# rpm -qip spacewalk-selinux-1.4.1-1.el5-test.src.rpm
Name : spacewalk-selinux Relocations: (not relocatable)
Version : 1.4.1 Vendor: Koji
Release : 1.el5 Build Date: Thu 03 Mar 2011 08:57:31 PM EST
Install Date: (not installed) Build Host: domU-12-31-38-00-09-D1
Group : System Environment/Base Source RPM: (none)
Size : 14214 License: GPLv2+
Signature : DSA/SHA1, Tue 26 Apr 2011 03:57:18 AM EST, Key ID ed635379b3892132
Packager : Koji
URL : http://fedorahosted.org/spacewalk
Summary : SELinux policy module supporting Spacewalk Server
Description :
SELinux policy module supporting Spacewalk Server.
[root@server ~]# rpm --resign spacewalk-selinux-1.4.1-1.el5-test.src.rpm
Enter pass phrase:
Pass phrase is good.
spacewalk-selinux-1.4.1-1.el5-test.src.rpm:
gpg: WARNING: standard input reopened
gpg: WARNING: standard input reopened
[root@server ~]# rpm -qip spacewalk-selinux-1.4.1-1.el5-test.src.rpm
Name : spacewalk-selinux Relocations: (not relocatable)
Version : 1.4.1 Vendor: Koji
Release : 1.el5 Build Date: Thu 03 Mar 2011 08:57:31 PM EST
Install Date: (not installed) Build Host: domU-12-31-38-00-09-D1
Group : System Environment/Base Source RPM: (none)
Size : 14214 License: GPLv2+
Signature : DSA/SHA1, Mon 19 Aug 2013 12:21:12 PM EST, Key ID 6cf907deb8607f33 ## Key has changed
Packager : Koji
URL : http://fedorahosted.org/spacewalk
Summary : SELinux policy module supporting Spacewalk Server
Description :
SELinux policy module supporting Spacewalk Server.