Package
Management System is a collection of software tools to
automate the process of installing, upgrading, configuring, and removing
software packages for a OS in a consistent manner.
RPM
is Package Management System introduced by
RedHat. RPM typically contains the compiled version of the software. Originally
standing for “Red Hat Package Manager”, RPM now stands for “RPM
Package Manager”,
Package
Management System is a collection of software tools to
automate the process of installing, upgrading, configuring, and removing
software packages for a OS in a consistent manner.
RPM
is Package Management System introduced by
RedHat. RPM typically contains the compiled version of the software. Originally
standing for “Red Hat Package Manager”, RPM now stands for “RPM
Package Manager”,
SRPM contains either the source code corresponding to that
RPM or the scripts of a non-compiled software package
This document contains quick reference for
RPM
You can download RPM files from
rpmfind.net, rpm.org.
—-> One way to install everything in
Windows : setup.exe [setup.msi]
—-> In Linux there are 2 ways to
install :
1. rpm
– From RedHat Inc
2. tarball – Installation by compiling
Source code
1.
RPM command reference
—
rpm -qa
-> List all
installed packages [/root/install.log]
rpm -ivh x-2.0.rpm –percent -> It will provide installation
status in Percentage format.
rpm -ivh –nodeps x.rpm -> Avoid dependency check
before installation
rpm –force -ivh x-2.0.rpm à It will forcefully install
rpm -Uvh x.rpm ->
It will Upgrade current installed package
rpm -Fvh x.rpm -> It will Forcefully upgrade
rpm -e
x.rpm ->
Uninstall
rpm -evv –test x.rpm -> Test Uninstall
rpm -qi
x.rpm ->
It will show weather the package is installed or not.
rpm -qa |grep x -> It will show weather the package
‘x’ is installed or not.
rpm -q –whatrequires Xorg -> If u remove the Xorg rpm what
other rpms are dependent on this
rpm -q –whatprovides `which gpm` —-| The binary ‘gpm’ comes from which rpm,
in case it got deleted
rpm -qf
`which gpm` —-|
both are same
rpm -qlp x.rpm ->
List all files of x.rpm before installation.
rpm -qpc x.rpm ->
List all configuration files of x
rpm -qpd x.rpm ->
List all docs of x
rpm -qf
<installed package_name> -> same like ‘rpm -q
-whatprovides’
What does a rpm file mostly contains?
Like a winzip file but on ‘rpm -ivh’ will
install each file/s in the correct FSHSTND – responsibility of the RPM programmer
1. config files : will be
installed in /etc
2. binaries : will be installed in the 4 directories –
DEPENDS
3. docs : /usr/share/doc/name-of-rpm/
4. man : /usr/share/man/man1/ …. man9/
5. info : /usr/share/info/x.gz
6. log files : /var/…
RPM database: /var/lib/rpm/Packages
rpm –rebuilddb [or –initdb] and if this
also hangs then reboot and do again
# rpm -V pkg-name
Building an RPM from a TarBall
# rpmbuild -ta sometarball.tar.gz
or
if you have an older version of rpm which
does not contain the rpmbuild*
# rpm –rebuild sometarball.tar.gz
====================================================================
Advance Usage of RPM
# rpm -qa –queryformat ‘%{NAME} was installed on
%{INSTALLTIME:date}n’
Output à
……………
……………
linuxwacom was installed on Tue 15 Feb 2011
02:31:06 AM IST
minicom was installed on Tue 15 Feb 2011
02:32:14 AM IST
likewise-srvsvc was installed on Tue 15 Feb
2011 12:12:34 PM IST
likewise-netlogon was installed on Tue 15
Feb 2011 12:12:38 PM IST
gpg-pubkey was installed on Tue 05 Apr 2011
10:00:40 AM IST
…………..
…………..
# rpm -q –queryformat ‘%{NAME}: %{FILENAMES}n’ httpd
httpd: /etc/httpd
# rpm -q –queryformat ‘%{NAME}: [%{FILENAMES}n]’ httpd
httpd: /etc/httpd
/etc/httpd/conf
/etc/httpd/conf.d
/etc/httpd/conf.d/README
/etc/httpd/conf.d/proxy_ajp.conf
/etc/httpd/conf.d/welcome.conf
/etc/httpd/conf/httpd.conf
/etc/httpd/conf/magic
/etc/httpd/logs
/etc/httpd/modules
/etc/httpd/run
/etc/logrotate.d/httpd
………..
………….
It will show all installed files with ‘httpd’.
# rpm -q
–queryformat ‘%{NAME}: [%{FILENAMES} (%{FILESIZES} bytes)n]’ httpd
httpd: /etc/httpd (4096 bytes)
/etc/httpd/conf (4096 bytes)
/etc/httpd/conf.d (4096 bytes)
/etc/httpd/conf.d/README (392 bytes)
/etc/httpd/conf.d/proxy_ajp.conf (566 bytes)
/etc/httpd/conf.d/welcome.conf (299 bytes)
/etc/httpd/conf/httpd.conf (33726 bytes)
/etc/httpd/conf/magic (13139 bytes)
/etc/httpd/logs (19 bytes)
/etc/httpd/modules (27 bytes)
/etc/httpd/run (13 bytes)
/etc/logrotate.d/httpd (167 bytes)
/etc/rc.d/init.d/httpd (3263 bytes)
/etc/sysconfig/httpd (616 bytes)
/usr/bin/ab (47556 bytes)
/usr/bin/htdbm (14196 bytes)
/usr/bin/htdigest (8872 bytes)
/usr/bin/htpasswd (11716 bytes)
/usr/bin/logresolve (8096 bytes)
/usr/lib/httpd (4096 bytes)
/usr/lib/httpd/modules (4096 bytes)
………..
………….
It will show list of files with thir sizes. You can change unit to bytes
to kb etc.
# rpm -q --queryformat '[%{=NAME}: %{FILENAMES} (%{FILESIZES} bytes)n]' httpd
httpd: /etc/httpd (4096 bytes)
httpd: /etc/httpd/conf (4096 bytes)
httpd: /etc/httpd/conf.d (4096 bytes)
httpd: /etc/httpd/conf.d/README (392 bytes)
httpd: /etc/httpd/conf.d/proxy_ajp.conf (566 bytes)
httpd: /etc/httpd/conf.d/welcome.conf (299 bytes)
httpd: /etc/httpd/conf/httpd.conf (33726 bytes)
httpd: /etc/httpd/conf/magic (13139 bytes)
httpd: /etc/httpd/logs (19 bytes)
httpd: /etc/httpd/modules (27 bytes)
httpd: /etc/httpd/run (13 bytes)
httpd: /etc/logrotate.d/httpd (167 bytes)
…………
………
# rpm --querytags
It will show all list of tags you can use for queryformat.
