rpm introduction
TRANSCRIPT
RPM
Redhat Package ManagerT [email protected]
Install Packages
Source Compilation
Installpkg
Rpm
dpkg
What RPM can do?
Install
Remove
Query
Verify
Upgrade
Who use it?
Redhat
Fedora
CentOS
Mandriva
SuSE
...
RPM Terminology
kernel-smp-2.4.18-3.athlon.rpm kernel-smp-2.4.18-3.i586.rpm kernel-smp-2.4.18-3.i686.rpm kernel-source-2.4.18-3.i386.rpm rootfiles-7.2-1.noarch.rpm
name-version-release.architecture.rpm
RPM Database
Dir : /var/lib/rpm
# cd /var/lib/rpm# lstotal 3534-rw-r--r-- 1 root root 1351680 Oct 17 10:35 fileindex.rpm-rw-r--r-- 1 root root 16384 Oct 17 10:35 groupindex.rpm-rw-r--r-- 1 root root 16384 Oct 17 10:35 nameindex.rpm-rw-r--r-- 1 root root 2342536 Oct 17 10:35 packages.rpm-rw-r--r-- 1 root root 16384 Oct 17 10:35 providesindex.rpm-rw-r--r-- 1 root root 16384 Oct 17 10:35 requiredby.rpm#
Operations
Some Commands
rpm -U filename.rpm
rpm -i xcopilot-0.6.6-3.i386.rpm
rpm -U xcopilot-0.6.6-3.i386.rpm
rpm -Uhv xcopilot-0.6.6-3.i386.rpm
rpm e package_name
rpm qa | more
Install
Performing dependency checks.
Checking for conflicts.
Performing any tasks required before the install.
Deciding what to do with config files.
Unpacking files from the package and putting them in the proper place.
Performing any tasks required after the install.
Keeping track of what it did.
Install Options
Examples
# rpm -ivv eject-1.2-2.i386.rpmD: installing eject-1.2-2.i386.rpmInstalling eject-1.2-2.i386.rpmD: package: eject-1.2-2 files test = 0D: running preinstall script (if any)D: setting file owners and groups by name (not id)D: ///usr/bin/eject owned by root (0), group root (0) mode 755D: ///usr/man/man1/eject.1 owned by root (0), group root (0) mode 644D: running postinstall script (if any)#
Examples
# rpm -i --test rpm-2.0.11-1.i386.rpm/bin/rpm conflicts with file from rpm-2.3-1/usr/bin/gendiff conflicts with file from rpm-2.3-1/usr/bin/rpm2cpio conflicts with file from rpm-2.3-1/usr/bin/rpmconvert conflicts with file from rpm-2.3-1/usr/man/man8/rpm.8 conflicts with file from rpm-2.3-1error: rpm-2.0.11-1.i386.rpm cannot be installed#
UnInstall rpm -e
It checks the RPM database to make sure that no other packages depend on the package being erased.
It executes a pre-uninstall script (if one exists).
It checks to see if any of the package's config files have been modified. If so, it saves copies of them.
It reviews the RPM database to find every file listed as being part of the package, and if they do not belong to another package, deletes them.
It executes a post-uninstall script (if one exists).
It removes all traces of the package (and the files belonging to it) from the RPM database.
Erase Example
# rpm -evv ejectD: uninstalling record number 286040D: running preuninstall script (if any)D: removing files test = 0D: /usr/man/man1/eject.1 - removingD: /usr/bin/eject - removingD: running postuninstall script (if any)D: removing database entryD: removing name indexD: removing group indexD: removing file index for /usr/bin/ejectD: removing file index for /usr/man/man1/eject.1#
Upgrade
rpm -U
Installs the desired package.Erases all older versions of the package, if any exist.
# rpm -U eject-1.2-2.i386.rpm
Query
Query Examples
# rpm -q libclibc-5.2.18-1
# rpm -qa | grep -i sysvSysVinit-2.64-2
# rpm -qf /bin/lsFileutils-3.12-3
# rpm -qp foo.barrpm-2.3-1
Query Examples
# rpm -qi rpmName : rpm Distribution: Red Hat Linux VanderbiltVersion : 2.3 Vendor: Red Hat SoftwareRelease : 1 Build Date: Tue Dec 24 09:07:59 1996Install date: Thu Dec 26 23:01:51 1996 Build Host: porky.redhat.comGroup : Utilities/System Source RPM: rpm-2.3-1.src.rpmSize : 631157Summary : Red Hat Package ManagerDescription :RPM is a powerful package manager, which can be used to build, install,query, verify, update, and uninstall individual software packages. Apackage consists of an archive of files, and package information, includingname, version, and description.
-c Display the Package's List of Configuration Files
# rpm -qc XFree86/etc/X11/fs/config/etc/X11/twm/system.twmrc/etc/X11/xdm/GiveConsole/etc/X11/xdm/TakeConsole/etc/X11/xdm/Xaccess/etc/X11/xdm/Xresources/etc/X11/xdm/Xservers/etc/X11/xdm/Xsession/etc/X11/xdm/Xsetup_0/etc/X11/xdm/chooser
Query
-d Display a List of the Package's Documentation
# rpm -qdcf /sbin/dump/etc/dumpdates/usr/doc/dump-0.3-5/usr/doc/dump-0.3-5/CHANGES/usr/doc/dump-0.3-5/COPYRIGHT/usr/doc/dump-0.3-5/INSTALL/usr/doc/dump-0.3-5/KNOWNBUGS/usr/doc/dump-0.3-5/THANKS/usr/doc/dump-0.3-5/dump-0.3.announce/usr/doc/dump-0.3-5/dump.lsm/usr/doc/dump-0.3-5/linux-1.2.x.patch
Query
--scripts Show Scripts Associated With a Package
# rpm -q --scripts XFree86preinstall script:(none)postinstall script:/sbin/ldconfig/sbin/pamconfig --add --service=xdm --password=none --sesslist=nonepreuninstall script:(none)postuninstall script:/sbin/ldconfigif [ "$1" = 0 ] ; then /sbin/pamconfig --remove --service=xdm --password=none --sesslist=nonefiverify script: (none)
Query
# rpm -qid bashName :bash Distribution: Red Hat Linux (Picasso)Version :1.14.6 Vendor: Red Hat SoftwareRelease :2 Build Date: Sun Feb 25 13:59:26 1996Install date:Mon May 13 12:47:22 1996 Build Host: porky.redhat.comGroup :Shells Source RPM: bash-1.14.6-2.src.rpmSize :486557Description :GNU Bourne Again Shell (bash)/usr/doc/bash-1.14.6-2/usr/doc/bash-1.14.6-2/NEWS/usr/doc/bash-1.14.6-2/README/usr/doc/bash-1.14.6-2/RELEASE/usr/info/bash.info.gz/usr/man/man1/bash.1#
Finding Documentation for a Specific Package
# rpm -qa --queryformat '%10{NAME} %20{GROUP}\n' | grep -i shells ash Shells bash Shells csh Shells mc Shells tcsh Shells#
Finding Similar Packages
# rpm -qa --queryformat '%{installtime} %{name}-%{version}-%{release} %{installtime:date}\n' | sort -nr | sed -e 's/^[^ ]* //'rpm-devel-2.3-1 Thu Dec 26 23:02:05 1996rpm-2.3-1 Thu Dec 26 23:01:51 1996pgp-2.6.3usa-2 Tue Oct 22 19:39:09 1996pamconfig-0.50-5 Tue Oct 15 17:23:22 1996setup-1.5-1 Tue Oct 15 17:23:21 1996#
Finding Recently Installed Packages
# rpm -qa --queryformat '%{installtime} %{name}-%{version}-%{release} %{installtime:date}\n' | sort -nr| lesskernel-source-2.0.18-5 20608472tetex-0.3.4-3 19757371emacs-el-19.34-1 12259914rootfiles-1.3-1 3494mkinitrd-1.0-1 1898redhat-release-4.0-1 22#
Finding the Largest Installed Packages
Making Free space
Find the documentation filesrpm -qda|wc -lfor i in `rpm -qda`; do if [ -f $i ]; then echo `ls -l $i|awk -F ' ' '{print \$5}'`; fi; done >size
Verify
Owner
Group
Mode
MD5 Checksum
Size
Major Number
Minor Number
Symbolic Link String
Modification Time
Misc Options
# rpm rebuilddb
# rpm initdb
# rpm help|less
# rpm --version
SRPM RPM with Source
For automatic compilation and Installation
spec file
Where to get?
rpm.pbone.net
rpmfind.net
dag.wieers.com/rpm/packages
freshrpms.net
Thanks
http://www.rpm.org/max-rpm/
http://docs.fedoraproject.org/drafts/rpm-guide-en/index.html
Questions ?
OperationShort OptionLong Option
Upgrade/install -U --upgrade
Install -I --install
Remove -e --erase
Query -q --query
Verify -V --verify
Check signature -K --checksig
Freshen (upgrade) already-installed package -F --freshen
Initialize database None --initdb
Rebuild database None --rebuilddb
???Page ??? (???)25/09/2009, 22:10:09Page / rpm -i (or --install) options file1.rpm fileN.rpm Parameters file1.rpm fileN.rpm One or more RPM package files (URLs OK) Install-specific Options -h (or --hash) Print hash marks ("#") during install --test Perform installation tests only --percent Print percentages during install --excludedocs Do not install documentation --includedocs Install documentation --replacepkgs Replace a package with a new copy of itself --replacefiles Replace files owned by another package --force Ignore package and file conflicts --noscripts Do not execute pre- and post-install scripts --prefix Relocate package to if possible --ignorearch Do not verify package architecture --ignoreos Do not verify package operating system --nodeps Do not check dependencies --ftpproxy Use as the FTP proxy --ftpport Use as the FTP port General Options -v Display additional information -vv Display debugging information --root Set alternate root to --dbpath Use to find the RPM database
???Page ??? (???)30/09/2009, 12:52:14Page / rpm -U (or --upgrade)options file1.rpm fileN.rpm Parameters file1.rpm fileN.rpm One or more RPM package files (URLs OK) Upgrade-specific Options -h (or --hash) Print hash marks ("#") during upgrade[a] --oldpackage Permit "upgrading" to an older package --test Perform upgrade tests only--excludedocs Do not install documentation--includedocs Install documentation--replacepkgs Replace a package with a new copy of itself--replacefiles Replace files owned by another package--force Ignore package and file conflicts --percent Print percentages during upgrade--noscripts Do not execute pre- and post-install scripts --prefix Relocate package to if possible--ignorearch Do not verify package architecture--ignoreos Do not verify package operating system--nodeps Do not check dependencies--ftpproxy Use as the FTP proxy--ftpport Use as the FTP portGeneral Options -v Display additional information-vv Display debugging information--root Set alternate root to --dbpath Use to find the RPM database
???Page ??? (???)30/09/2009, 13:55:05Page / Package Selection Options pkg1 pkgN Query installed package(s) -p (or "-") Query package file (URLs OK) -f Query package owning -a Query all installed packages --whatprovides Query packages providing capability -g Query packages belonging to group --whatrequires Query packages requiring capability Information Selection Options Display full package label -i Display summary package information -l Display list of files in package -c Display list of configuration files -d Display list of documentation files -s Display list of files in package, with state --scripts Display install, uninstall, verify scripts --queryformat (or --qf) Display queried data in custom format --dump Display all verifiable information for each file --provides Display capabilities package provides --requires (or -R) Display capabilities package requires General Options -v Display additional information -vv Display debugging information --root Set alternate root to --rcfile Set alternate rpmrc file to --dbpath Use to find the RPM database
???Page ??? (???)30/09/2009, 13:55:05Page /