RPM package database /var/lib/rpm
*.rpm – Used to install, uninstall, upgrade, query, verify a package in Redhat and SuSe Linux
rpm [option] [package_name(PN)/ package_filename(PFN)]
-i <PFN> : To install the package if not installed
-F <PFN> : To upgrade the package if older version already exists
-U <PFN> : To install/upgrade the package
-e <PN> : To remove the package (if no dependencies exist)
–nodeps : ignores dependency check while installing/upgrading/removing packages
–force : Replace package dependencies automatically while installing packages
-v : Verbose
-h : Shows installation program bar in terms of hash symbol
q [sub-options] <PN> : to determine whether the package is installed or not
Query [sub-options]
-a : Displays the list of all installed packages
-f <file-name: Displays the name of the package which contains the file
-i <PN> : Displays brief information about the package
-l <PN> : Displays the list of all the files that are contained in the package
-p <PFN> : To query an uninstalled package
–requires <PN> : Displays the dependencies of the package
–scripts <PN>: Displays the scripts executed while installing the package
–changelog <PN> : Displays package revision history.
–whatrequires <capability> : Displays the list of packages that requires the capability
–whatprovides <capability> : Displays the list of package that provides that capability (library file search)
History
[root@localhost ~]# rpm -q –changelog httpd | less
* Wed Mar 21 2007 Karanbir Singh <kbsingh@centos.org> 2.2.3-6.el5.centos.1
- Roll in the CentOS Mods* Wed Nov 29 2006 Joe Orton <jorton@redhat.com> 2.2.3-6.el5
- fix path to instdso.sh in special.mk (#217677)
- fix detection of links in “apachectl fullstatus”* Tue Sep 19 2006 Joe Orton <jorton@redhat.com> 2.2.3-5.el5
- rebuild* Fri Aug 11 2006 Joe Orton <jorton@redhat.com> 2.2.3-3.el5
- use RHEL branding* Thu Aug 03 2006 Joe Orton <jorton@redhat.com> 2.2.3-3
- init: use killproc() delay to avoid race killing parent* Fri Jul 28 2006 Joe Orton <jorton@redhat.com> 2.2.3-2
- update to 2.2.3
- trim %changelog to >=2.0.52* Thu Jul 20 2006 Joe Orton <jorton@redhat.com> 2.2.2-8
- fix segfault on dummy connection failure at graceful restart (#199429)
Script check
[root@localhost ~]# rpm -q –scripts httpd
preinstall scriptlet (using /bin/sh):
# Add the “apache” user
/usr/sbin/useradd -c “Apache” -u 48 \
-s /sbin/nologin -r -d /var/www apache 2> /dev/null || :
postinstall scriptlet (using /bin/sh):
# Register the httpd service
/sbin/chkconfig –add httpd
preuninstall scriptlet (using /bin/sh):
if [ $1 = 0 ]; then
/sbin/service httpd stop > /dev/null 2>&1
/sbin/chkconfig –del httpd
fi
To find the package dependencies
[root@localhost ~]# rpm -q –requires httpd
/bin/bash
/bin/mktemp
/bin/mv
/bin/rm
/bin/sh
/bin/sh
/bin/sh
/bin/sh
/bin/sh
/etc/mime.types
/sbin/chkconfig
/usr/bin/find
/usr/sbin/useradd
/usr/share/magic.mime
config(httpd) = 2.2.3-6.el5.centos.1
gawk
initscripts >= 8.36
libapr-1.so.0
libaprutil-1.so.0
libc.so.6
libc.so.6(GLIBC_2.0)
libc.so.6(GLIBC_2.1)
libc.so.6(GLIBC_2.1.3)
libc.so.6(GLIBC_2.2)
libc.so.6(GLIBC_2.3)
libc.so.6(GLIBC_2.3.4)
libc.so.6(GLIBC_2.4)
libcrypt.so.1
libcrypt.so.1(GLIBC_2.0)
libcrypto.so.6
libdb-4.3.so
libdl.so.2
libexpat.so.0
liblber-2.3.so.0
libldap-2.3.so.0
libm.so.6
libm.so.6(GLIBC_2.0)
libpcre.so.0
libpthread.so.0
libpthread.so.0(GLIBC_2.0)
libselinux.so.1
libssl.so.6
libz.so.1
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(VersionedDependencies) <= 3.0.3-1
rtld(GNU_HASH)
sh-utils
textutils
To find library or packages or filename
[root@localhost ~]# rpm -q –whatprovides libssl.so.6
openssl-0.9.8b-8.3.el5[root@localhost ~]# rpm -q openssl
openssl-0.9.8b-8.3.el5
Opposite of Dependencies
[root@localhost ~]# rpm -q –whatrequires libssl.so.6
openssl-0.9.8b-8.3.el5
python-2.4.3-19.el5
openldap-2.3.27-5
curl-7.15.5-2.el5
postgresql-libs-8.1.4-1.1
php-cli-5.1.6-5.el5
python-ldap-2.2.0-2.1
m2crypto-0.16-6.el5.1
httpd-2.2.3-6.el5.centos.1
sendmail-8.13.8-2.el5
php-5.1.6-5.el5
stunnel-4.15-2
distcache-1.4.5-14.1
wpa_supplicant-0.4.8-10.1.fc6
neon-0.25.5-5.1
mysql-5.0.22-2.1
perl-Net-SSLeay-1.30-4.fc6
tog-pegasus-2.5.2-5.el5
spamassassin-3.1.7-4.el5
dovecot-1.0-1.2.rc15.el5
cadaver-0.22.3-4.el5
mod_ssl-2.2.3-6.el5.centos.1
fetchmail-6.3.6-1.el5
squid-2.6.STABLE6-3.el5
gnupg-1.4.5-12
openldap-clients-2.3.27-5
lftp-3.5.1-2.fc6
wget-1.10.2-7.el5
slrn-0.9.8.1pl1-1.2.2
elinks-0.11.1-5.1.el5
nmap-4.11-1.1
gnome-vfs2-2.16.2-4.el5
modcluster-0.8-27.el5.centos
mutt-1.4.2.2-3.el5
ricci-0.8-30.el5
cluster-snmp-0.8-27.el5.centos
cluster-cim-0.8-27.el5.centos
To find the location of installed packages
[root@localhost ~]# rpm -ql nmap
/usr/bin/nmap
/usr/share/doc/nmap-4.11
/usr/share/doc/nmap-4.11/COPYING
/usr/share/doc/nmap-4.11/COPYING.OpenSSL
/usr/share/doc/nmap-4.11/README
/usr/share/doc/nmap-4.11/nmap.usage.txt
/usr/share/man/man1/nmap.1.gz
/usr/share/nmap
/usr/share/nmap/nmap-mac-prefixes
/usr/share/nmap/nmap-os-fingerprints
/usr/share/nmap/nmap-protocols
/usr/share/nmap/nmap-rpc
/usr/share/nmap/nmap-service-probes
/usr/share/nmap/nmap-services
/usr/share/nmap/nmap.dtd
/usr/share/nmap/nmap.xsl
To remove package
[root@localhost ~]# rpm -e httpd
error: Failed dependencies:
httpd-mmn = 20051115 is needed by (installed) php-5.1.6-5.el5.i386
httpd-mmn = 20051115 is needed by (installed) mod_ssl-2.2.3-6.el5.centos.1.i386
httpd-mmn = 20051115 is needed by (installed) mod_python-3.2.8-3.1.i386
httpd-mmn = 20051115 is needed by (installed) mod_perl-2.0.2-6.1.i386
webserver is needed by (installed) webalizer-2.01_10-30.1.i386
httpd = 0:2.2.3-6.el5.centos.1 is needed by (installed) mod_ssl-2.2.3-6.el5.centos.1.i386
httpd is needed by (installed) piranha-0.8.4-7.el5.i386
httpd >= 2.2.0 is needed by (installed) gnome-user-share-0.10-6.el5.i386
httpd >= 2.0.40 is needed by (installed) mod_python-3.2.8-3.1.i386
httpd = 2.2.3-6.el5.centos.1 is needed by (installed) httpd-manual-2.2.3-6.el5.centos.1.i386
httpd is needed by (installed) system-config-httpd-1.3.3.1-1.el5.noarchuse
# rpm -e –nodeps httpd
Package Verification
# rpm -V package name : Checks the integrity of the package against the installed database.
# rpm -Va : Checks the integrity of all installed packages against the installed database.
# rpm –import /mnt/cdrom/RPM-GPG-KEY (imports {installs} the public key for package verification)
# rpm –checksig package_file_name : Verifies the signature of the package.


