rpmbuild
Current Windows Versions
pkgadd
) unpacks the archive, copies the files into their final destinations based on the enclosed listing, and sets permissions and ownerships on the files as specified by the listing. Finally, this pkgadd
command registers the list of freshly installed files into a system-wide database of installed files.
deep-package
(still available from http://www2.cddc.vt.edu/linux/distributions/deeplinux/tools). deep-package
was intended to be a complete reimplementation of the Solaris pkgadd
utility and its helpers. Like the Solaris pkgadd
software, deep-package
paid no attention to half of the question of how to manage software, focusing entirely on software installation and tracking issues while entirely ignoring the initial compilation of the software.
Change of Name
grep
, awk
, and sed
; an editor, such as vi
; a shell, such as the Bourne-Again bash
shell; and so forth) to complete the various tasks for which they typically employ Linux.
pms
) software that was used with it for installation and uninstallation of all software on an application-by-application basis. Shortly thereafter, in the summer of 1994, the first public betas of Red Hat Commercial Linux were released. Red Hat initially used Red Hat Software Program Packages (RPP) as the basis of its Linux distribution. Like pms
, RPP was a system-management tool that allowed for easy installation and uninstallation of applications. In late 1993, Ian Murdock founded the Debian Gnu/Linux distribution. He began seriously developing its dpkg
application-management software by the summer of 1994. Like pms
and RPP, dpkg
made it possible to manage each application on the system.
pms
software. Developers at Red Hat, particularly Marc Ewing and Erik Troan, set out to develop what they initially called the Red Hat Package Manager (RPM). Based on experiences with earlier Linux packaging software and knowledge about packaging tools used on other platforms, Red Hat had several design goals in mind when they developed RPM. These design points include the following features:
rpm -U software_package
), while manual software installation using older manual methods typically requires at least six steps to complete the same task:
tar zxf software_package
cd software_package
./configure
make
su
make install
rpm -e software_package
); manual removal of an installed application requires that each file associated with that application be manually deleted.
/etc/httpd/conf/httpd.conf
. Suppose Apache has been installed using RPM and that you have then customized httpd.conf
to specify its configuration. If you upgrade Apache using RPM, as part of the upgrade procedure, the RPM application will take precautions to preserve the customizations you have made to the Apache configuration. In contrast, manual upgrades of applications often overwrite any existing configuration files, losing all site customizations the system administrator has made.
EventLog
(the Windows application that records system events, much like the Linux syslogd
and klogd
software) to be present. Since Windows is managed on a system level, not a package level, this dependency is guaranteed to be satisfied. On Linux systems using RPM, however, the situation is different. On Linux, for example, the Postfix application requires the syslogd
application, which records system events. However, RPM provides the flexibility to install some applications but not install others or to uninstall others later. When you install Postfix, you have no guarantee that syslogd
is already installed. If syslogd
is not installed, Postfix will not work correctly.
syslogd
installed generates a warning that syslogd
must also be installed. Similarly, attempting to uninstall syslogd
from a system that already has Postfix installed generates a warning that installed applications require the software that is being deleted. These warnings can be overridden if necessary, but by default RPM enforces these dependencies (refusing, for example, to let you uninstall syslogd
without also uninstalling applications that require it, such as Postfix), preventing you from accidentally breaking applications by inadvertently uninstalling other software that they require to operate.
pms
packaging system introduced the use of pristine source code to prepare packages. With Red Hat's early RPP package system and other similar early efforts, software packagers would compile software manually, then run commands to produce a package of that compiled software. Any changes made to the application's original source code were not recorded and would have to be recreated by the next person to package that software. Furthermore, end users wanting to know what changes had been made to the software they were running had no method of accessing that information.
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
kernel-smp
can be installed to provide a very important application, the SMP (symmetric multiprocessing, meaning it supports systems with more than one CPU in them) version of the Linux kernel, on the system. Sometimes, rather than an application, the software is a collection of other files needed on the system. The rootfiles
package, for example, is not an application but is a collection of basic environmental configuration files for the root
user's account (such as /root/.bashrc
, the root
user's Bash configuration file) that provides a usable, preconfigured working environment for the root
user.
kernel-smp-2.4.18
indicates the RPM holds the 2.4.18 release of the SMP version of the Linux kernel, and rootfiles-7.2
is the 7.2 release of the rootfiles
configuration files.
rootfiles-7.2-1
package shows this is the first release of the 7.2 version of the rootfiles
software. The packager of rootfiles
version 7.2 got everything right on the first try and had no need to prepare more than one release. The –3 in the kernel-smp-2.4.18-3
package, on the other hand, is the third release of the 2.4.18 version of the SMP-capable Linux kernel. This release incorporates new patches to fix bugs present in older releases of the 2.4.18 version of the Linux SMP kernel. The software packager increased the release number so that end users could distinguish the more recent, bug-fixed package file from the older, less bug-free package file.
kernel-smp-2.4.18-3.athlon
package is intended for use on machines with an AMD Athlon CPU, and kernel-smp-2.4.18-3.i586
is intended for use on machines with an i586 (Pentium-class) CPU or better. An architecture name of noarch indicates this is a special architecture such that the files in the package work on any architecture. Typically, this is because the files are all interpreted scripts, not binary executables, or are documentation.
Platform
|
Architectures
|
Intel compatible 32-bit
|
i386, i486, i586, i686, athlon
|
Intel compatible 64-bit
|
ia64
|
HPAlpha (formerly Digital, Compaq)
|
alpha, alphaev5, alphaev56, alphapca56, alphaev6, alphaev67
|
Sparc/Ultra Sparc (Sun)
|
sparc, sparcv9, sparc64
|
ARM
|
armv3l, armv4b, armv4l
|
MIPS
|
mips, mipsel
|
Power PC
|
ppc, ppciseries, ppcpseries, ppc64
|
Motorola 68000 series
|
m68k, m68kmint
|
SGI MIPS
|
Sgi
|
IBM RS6000
|
rs6000
|
IBM S/390
|
i370, s390x, s390
|
Platform independent
|
noarch
|
Architecture Compatibility
kernel-source
is a valid software name. Finally, keep in mind that all RPM package files use an .rpm file-name extension to denote that they are RPMs.
name-version-release
. Once installed, packages are referred to without the architecture field and the .rpm extension. Furthermore, installed packages consist of lots of files, not a single RPM file. For example, the package file kernel-smp-2.4.18-3.i686.rpm
after installation is referred to as kernel-smp-2.4.18-3
. To simplify usage even further, installed packages can be referred to by their name field only, so this file would become simply kernel-smp
.
Software Names May Differ from Package Names
rpm –q
command to query for all installed versions of the given package, kernel-smp
.
The RPM Database
kernel-smp
software, I have to use the full package name (such as kernel-smp-2.4.18-4
) whenever I want to work with my installed kernel-smp
packages.
xcopilot
package:
xcopilot-0.6.6-3.i386.rpm
xcopilot
package, version 0.6.6, third build of an RPM package, for i386 (Intel) architecture systems.
gzip
format.
cpio
format, which is how the rpm2cpio
command (introduced in the "Other RPM commands" section later in this chapter) can do its work.
Finding More Software
xcopilot
package, mentioned previously, contains the xcopilot
application used for synchronization with Palm handheld devices. The source code used to create this application is stored in an xcopilot
source RPM, for example:
xcopilot-0.6.6-3.src.rpm
Source RPMs and Open Source Licencing
/var/lib/rpm/
, and should contain files like the following:
Basenames
Conflictname
__db.001
__db.002
__db.003
Dirnames
Filemd5s
Group
Installtid
Name
Packages
Providename
Provideversion
Pubkeys
Requirename
Requireversion
Sha1header
Sigmd5
Triggername
The RPM Database
__db.001
and similar files are lock files used by the RPM system. The other files are databases in Berkeley DB format. The most important file is Packages
. The Packages
file contains the header tag information for each package indexed by an index number for each package. This number slowly grows with time.
Name
, Providename
, and Group
, exist to speed access to particular types of information. Treat your RPM database with care. Back up the files, especially after upgrading, installing, or removing packages.
Recreating The RPM Database
Packages
file is essential. You can recreate the rest of the files using the rpm --rebuilddb
command, introduced in Chapter 4, Using the RPM Database.
rpm
. One of the original goals of the RPM system is providing ease of use. In support of this goal, just about everything you want to do with the RPM system can be done with this one command. For most usage, the command-line parameters to the rpm
command determine the actions it should take.
rpm
commandrpm
command performs the most common package-management functions, along with a host of uncommon functions as well. The table below lists the main operations you can perform with the rpm
command and the command-line options to specify the given operations.
Table 2.1. The main rpm
operations
Operation | Short Option | Long 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 |
rpm
command. To install or upgrade a package, use the -U
command-line option:
rpm -U filename.rpm
xcopilot
RPM used as an example in this chapter, run the following command:
rpm -U xcopilot-0.6.6-3.i386.rpm
-h
and -v
options in conjunction with the –U
option:
rpm -Uhv xcopilot-0.6.6-3.i386.rpm
–h
option, the rpm
command will print a series of hash marks, #, to provide feedback that the command is still running. With the –v
option, the rpm
command provides more verbose messages.
Installing a Package
rpm -Uhv package_file.rpm
–e
command-line option:
rpm –e package_name
Using File Extensions
rpm –qa
rpm –qa | more
rpm
Options
rpm
command.
rpm
, the RPM system includes a few more commands, including rpmbuild
and rpm2cpio
.
rpmbuild
command helps build RPM packages. I describe its usage in depth in Part II of this book.
rpm2cpio
command exports an RPM package file int the format that the cpio
command expects. The cpio
command works with many tape-backup packages. You can also take advantage of the fact that cpio
can list the individual files in a cpio
archive or extract files. To list the files in an RPM package, use a command like the following:
rpm2cpio package_file.rpm | cpio –t
xcopilot
package:
rpm2cpio xcopilot-0.6.6-3.i386.rpm | cpio –t
./etc/X11/applink/Applications/xcopilot.desktop ./usr/bin/xcopilot ./usr/doc/xcopilot-0.6.6 ./usr/doc/xcopilot-0.6.6/README ./usr/include/X11/pixmaps/xcopilot.xpm ./usr/include/X11/pixmaps/xcopilot2.xpm 3120 blocks
rpm2cpio
command can also help if you want to extract a single file from the RPM package, using the cpio –ivd
command-line options, as follows:
rpm2cpio xcopilot-0.6.6-3.i386.rpm | cpio –ivd usr/doc/xcopilot-0.6.6/README
usr/doc/xcopilot-0.6.6/
subdirectories and the README
file located under usr/doc/xcopilot-0.6.6/
.
–i
option tells cpio
to extract files. The –d
option tells cpio
to make any local subdirectories as needed (usr/doc/xcopilot-0.6.6/
, in this example), and the –v
option asks cpio
to politely output verbose messages about what it does. Of course, verbose is in the eye of the beholder; with many Unix and Linux commands, verbose output is still somewhat terse.
rpm
options you can use to get information and feedback on installation, for example.
rpm
Commandrpm
command. As a nice added benefit, just about everything you do with RPM requires a single invocation of the rpm
command. That means common tasks such as installing and removing software can be done quickly and efficiently. The basics of the rpm
command are not very hard, and you can perform the basic tasks within a few minutes of reading this chapter.
rpm
. Of course, this isn’t required, but just about every RPM package is stored in a file with a rpm
extension. For example, the following file holds an RPM package, ready to be installed:
jikes-1.16-1.i386.rpm
jikes
(a Java language compiler application). From the discussion in the last two chapters, you should be able to determine the version of the program this RPM holds and which release of the RPM package this represents.
jikes-1.16-1.src.rpm
src
in the package name is short for source. This file-naming convention is not required, but is used by just about all source code packages. (Following conventions helps other administrators know what to expect.)
Building Packages from Source RPMs
rpmbuild
for information on building RPMs from source RPMs.
rpm
command provides three main operations for upgrading and installing packages:
rpm
commandrpm
command with the –U
option, short for upgrade, as introduced in Chapter 2, RPM Overview . The basic syntax is:
rpm
-U
package_name
rpm –i jikes-1.16-1.i386.rpm
--upgrade
long option in place of -U
.
rpm
command, covered shortly, present positive feedback that the package has been installed.
rpm
command may print out warnings, such as the one following:
warning: pyxf86config-0.3.1-2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 897da07a
rpmbuild
covers signing packages. In most cases, warnings such as this one are not that serious. Errors, though, should be treated seriously.
root
Permissions
root
, or super user, permissions. That’s because most Linux application RPMs hold files that must be installed in a protected directory such as /usr/bin/
. In addition, RPM requires root access to modify the RPM database. Even if you could modify the system directories like /usr/bin/
, you must also be able to modify the RPM database to successfully install or remove packages.
rpm –q
command to quickly verify a package has been installed. To verify, you need to use the name of the installed package, not the name of the RPM file. You can also use a partial package name, such as jikes
in this case. For example:
rpm –q jikes
jikes-1.16-1
jikes-1.16-1
has been installed. This package name corresponds to the RPM file used in the preceding installation example.
rpm -q
command just asks the RPM database if the package has been installed. There may be other issues with the package that this command won’t show. For now, though, the rpm –q
command verifies that package has been installed.
package jikes is not installed
-h
option to the rpm
command prints out # signs, also called hash marks (hence the -h
). These hash marks provide some confirmation that the rpm
command is still running. This is important, since large packages may take a long time to install or upgrade. Run this command like the following:
rpm -Uh jikes-1.16-1.i386.rpm
########################################### [100%] ########################################### [100%]
########################################### [100%] warning: user cabbey does not exist - using root warning: user cabbey does not exist - using root warning: user cabbey does not exist - using root ########################################### [100%]
Reinstalling Packages
rpm
command won't complain. The upgrade operation, though, will remove all other versions of a package. This is one more reason to use the –U
upgrade option.
rpm
command. The -v
option to the rpm
command tells the command to print out verbose information as the command runs. Remember, though, that verbose is used in the traditional Unix and Linux meaning, which is normally not all that verbose. In the Unix/Linux context, verbose usually means slightly more than nothing. The syntax for the command follows:
rpm -Uhv jikes-1.16-1.i386.rpm
-v
command-line option, you will see output more like the following:
Preparing... ########################################### [100%] 1:jikes ########################################### [100%]
Standard Command for Package Installation
rpm -Uhv package_file.rpm
. That is, upgrade with verbose output and hashes.
-vv
command-line option. Think of this as doubly verbose. Usually, though, this extra information has no meaning unless you are debugging an RPM package that you are building. See the chapters in Part II on Creating RPMs for more on how to build RPM packages.
rpm -Uhvv jikes-1.16-1.i386.rpm
D: ============== jikes-1.16-1.i386.rpm D: Expected size: 702988 = lead(96)+sigs(100)+pad(4)+data(702788) D: Actual size: 702988 D: jikes-1.16-1.i386.rpm: MD5 digest: OK (2dba32192eca23eb480d1d02a9b6c022) D: added binary package [0] D: found 0 source and 1 binary packages D: opening db environment /var/lib/rpm/Packages joinenv D: opening db index /var/lib/rpm/Packages rdonly mode=0x0 D: locked db index /var/lib/rpm/Packages D: ========== +++ jikes-1.16-1 D: opening db index /var/lib/rpm/Depends create mode=0x0 D: Requires: rpm
lib(PayloadFilesHavePrefix) <= 4.0-1 YES (rpmlib provides) D: opening db index /var/lib/rpm/Providename rdonly mode=0x0 D: opening db index /var/lib/rpm/Pubkeys rdonly mode=0x0 D: read h# 9 Header V3 DSA signature: NOKEY, key ID 897da07a D: Requires: ld-linux.so.2 YES (db provides) D: read h# 9 Header V3 DSA signature: NOKEY, key ID 897da07a D: Requires: libc.so.6 YES (db provides) D: read h# 9 Header V3 DSA signature: NOKEY, key ID 897da07a D: Requires: libm.so.6 YES (db provides) D: read h# 633 Header V3 DSA signature: NOKEY, key ID 897da07a D: Requires: libstdc++-libc6.2-2.so.3 YES (db provides) D: read h# 9 Header V3 DSA signature: NOKEY, key ID 897da07a D: Requires: libc.so.6(GLIBC_2.0) YES (db provides) D: read h# 9 Header V3 DSA signature: NOKEY, key ID 897da07a D: Requires: libc.so.6(GLIBC_2.1) YES (db provides) D: read h# 9 Header V3 DSA signature: NOKEY, key ID 897da07a D: Requires: libc.so.6(GLIBC_2.1.3) YES (db provides) D: Requires: rpm
lib(CompressedFileNames) <= 3.0.4-1 YES (rpmlib provides) D: closed db index /var/lib/rpm/Pubkeys D: closed db index /var/lib/rpm/Depends D: closed db index /var/lib/rpm/Providename D: closed db index /var/lib/rpm/Packages D: closed db environment /var/lib/rpm/Packages D: ========== recording tsort relations D: ========== tsorting packages (order, #predecessors, #succesors, tree, depth)D: 0 0 0 0 0 +jikes-1.16-1 D: installing binary packages D: opening db environment /var/lib/rpm/Packages joinenv D: opening db index /var/lib/rpm/Packages create mode=0x42 D: getting list of mounted filesystems D: sanity checking 1 elements D: opening db index /var/lib/rpm/Name create mode=0x42 D: read h# 707 Header sanity check: OK D: computing 3 file fingerprints Preparing... D: computing file dispositions D: opening db index /var/lib/rpm/Basenames create mode=0x42 ########################################### [100%] package jikes-1.16-1 is already installed D: closed db index /var/lib/rpm/Basenames D: closed db index /var/lib/rpm/Name D: closed db index /var/lib/rpm/Packages D: closed db environment /var/lib/rpm/Packages
Short and Long Options
rpm
-U
, many programs use two minus signs to indicate longer option names. For example, with the rpm
command, -U
and --upgrade
are treated the same. You can use the short option, -U
, or the long option, --upgrade
.
--percent
. The --percent
option prints out decimal numbers that show the percentage completed as the rpm
command executes. This option is most useful if you wrap the rpm
command within some other command, such as a graphical user interface created from a Perl, Python, or Tcl/Tk script.
rpm -U --percent jikes-1.16-1.i386.rpm
%% 0.000000 %% 2.661902 %% 5.318614 %% 10.632039 %% 15.945465 %% 18.602177 %% 23.915603 %% 29.229028 %% 34.542453 %% 39.855879 %% 45.169304 %% 50.482729 %% 53.139442 %% 55.796154 %% 61.109580 %% 66.423005 %% 71.736430 %% 74.393143 %% 79.706568 %% 82.363281 %% 87.676706 %% 90.333419 %% 95.646844 %% 98.303557 %% 99.422736 %% 99.910411 %% 99.994892 %% 100.000000
--percent
option are really meant to be input into another program, perhaps a program that shows a graphical progress meter. Each number output then updates the meter.
Percentages may be Approximate
rpm –U
command or the rpm –i
command to install a package. When the rpm
command installs a package, it goes through a number of steps:
rpm
checks that all the dependencies are installed. Dependencies are packages required by the RPM package you want to install. For example, a database-administration package for a particular database may require that the database itself was already installed.
rpm
command checks for conflicting packages. For example, when you are trying to install an older version of a package on top of a newer version, running the rpm
command alerts you to that conflict. This conflict-checking goes deeper than packages, though. Individual files may conflict if you are trying to install a package that has an older version of a particular file.
rpm
command executes the preinstallation tasks (covered in depth in Part II). After all this preparatory work, the rpm
command finally gets down to business and installs the files in the package. These files are stored in compressed format (compressed with gzip
compression) inside the RPM file.
rpm
command updates the RPM database to reflect the new package information. This update is very important and allows you to track packages.
--test
command-line option tells the rpm
command to test the installation or upgrade process but not to install the file. For example, the following command performs an upgrade or install of the jikes
package, but in test mode only. No files will actually be installed.
rpm -U --test jikes-1.16-1.i386.rpm
package jikes-1.16-1 is already installed
chap4.txt: not an rpm
package (or package manifest):
eruby
, such as eruby-devel-0.9.8-2.i386.rpm
, will depend on a base ruby
package.
ruby
packages by using a command like the following:
rpm -q ruby
ruby
package, you'll see a message like the following:
package ruby is not installed
Package Names
ruby
.
--test
option comes in handy, since you can check that the dependencies are resolved prior to trying to install. (Note that the rpm
command will check dependencies on real installs as well. The --test
option just allows you to check that the installation will succeed prior to trying it.) For example, if you try to install a package named eruby-devel-0.9.8-2.i386.rpm
, you may want to run a --test
option first:
rpm -U --test eruby-devel-0.9.8-2.i386.rpm
ruby
packages installed:
error: Failed dependencies: eruby-libs = 0.9.8 is needed by eruby-devel-0.9.8-2
eruby-devel-0.9.8-2.i386.rpm
depends on another package, eruby-libs
in this case. In fact, this package depends on the eruby-libs
package having a version number of 0.9.8. These packages are obviously interrelated. From the name eruby-libs
, you can guess that the package will be in a file with a name like eruby-libs-0.9.8-2.i386.rpm
. (I cheated and used the actual package on the Red Hat installation CDs.)
eruby-devel-0.9.8-2.i386.rpm
eruby-libs-0.9.8-2.i386.rpm
eruby-devel-0.9.8-2.i386.rpm
depends on: eruby-libs-0.9.8-2.i386.rpm
. Just to be careful, though, you can test that package as well, with a command like the following:
rpm -U --test eruby-libs-0.9.8-2.i386.rpm
error: Failed dependencies: ruby-libs >= 1.6.4 is needed by eruby-libs-0.9.8-2 libruby.so.1.6 is needed by eruby-libs-0.9.8-2
rpm
command to install or upgrade one package at a time. You can optionally choose to install or upgrade a number of packages at the same time. Just list each file name on the rpm
command line. The basic syntax follows:
rpm -U package1.rpm package2.rpm .. package100.rpm
rpm -U aspell-en-ca-0.33.7.1-16.i386.rpm aspell-en-gb-0.33.7.1-16.i386.rpm
aspell
packages for Canadian and British English, respectively.
--noorder
option tells the rpm
command not to reorder the packages you are trying to install. Usually, the rpm
command will reorder the list of packages in the best order for handling the dependencies. This option really only comes into play when you are installing more than one package where the packages depend on each other. In most cases, you do not want to use this option, since this may mean that packages fail to properly install because necessary packages are not already installed.
--prefix
and --relocate
options should make the rpm
command relocate a package to a new location. Not all packages allow relocations, though. The basic format of the command with the --prefix
option is:
rpm -U --prefix /new/directory package.rpm
--relocate
option, the command format is:
rpm -i --relocate /old/directory=/new/directory package.rpm
--root
option to specify a different directory for the rpm
command to assume is the system's root, or /
, directory. This causes the rpm
command to install files under the new root, instead of in system locations under /
. This option is most useful for testing the installation of a complete system under a test directory. The command should use the following format:
rpm -U --root /tmp --dbpath /var/lib/rpm jikes-1.16-1.i386.rpm
--root
option tells the rpm
command that the root for this install is in /tmp/
. Installs with the --root
option take place within a chroot()
environment. This is often useful for setting up a test environment.
--dbpath
option tells the rpm
command that the RPM database is located in the normal location, /var/lib/rpm/
.
--dbpath
and --root
options will give you problems unless you have installed all the dependencies in the same virtual root directory. This includes all the standard Linux C libraries. For example, if you just run the example command, you'll see error output like the following:
error: Failed dependencies: ld-linux.so.2 is needed by jikes-1.16-1 libc.so.6 is needed by jikes-1.16-1 libm.so.6 is needed by jikes-1.16-1 libstdc++-libc6.2-2.so.3 is needed by jikes-1.16-1 libc.so.6(GLIBC_2.0) is needed by jikes-1.16-1 libc.so.6(GLIBC_2.1) is needed by jikes-1.16-1 libc.so.6(GLIBC_2.1.3) is needed by jikes-1.16-1
--badreloc
option with the --relocate
option to permit relocations on all files in the package. Usually, only those paths to files that are listed as relocatable are supported by the --relocate
option.
rpm
options cause the rpm
command to complain about problems and, in general, fail to install your package. You can use a number of options to run roughshod over the RPM and get it to do what you want.
--replacepkgs
option tells the rpm
command to replace, or reinstall, packages it may have already installed.
--replacefiles
option tells the rpm
command to overwrite files owned by a another package.
--justdb
option tells the rpm
command to update the RPM database, not to install the files. You will need to be logged in as the root user to modify the RPM database.
--nosuggest
option tells the rpm
command to skip any suggestions for packages that may fill in missing dependencies. You almost never want to use this option.
--excludepath
option tells the rpm
command to exclude all files that start with the given path. For example:
rpm -U --excludepath /usr/lib eruby-devel-0.9.8-2.i386.rpm
/usr/lib/
.
--allfiles
option tells the rpm
command to install or upgrade all files in the package, regardless of whether the files exist or not on your hard disk.
--oldpackage
tells the rpm
command to allow you to install an older version of a package on top of a more recent one. You don't usually want to do this, but you may need to under the following circumstances:
--force
, which tells the rpm
command to turn on the --replacepkgs
, --replacefiles
, and --oldpackage
modes.
--nodeps
command-line option tells the rpm
command to skip the dependencies check and install anyway.
Avoid Forcing Package Operations
rpm
command complains with good reason. Unless you really, really know what you are doing, don't force the issue by using these command-line options.
eruby-devel-0.9.8-2.i386.rpm
from the previous example. You can force the rpm
command to install this package, even though it depends on another package that in turn depends on yet another. The following command will force the installation of the package in the eruby-devel-0.9.8-2.i386.rpm
file:
rpm -U --nodeps eruby-devel-0.9.8-2.i386.rpm
rpm -q eruby-devel
eruby-devel-0.9.8-2
rpm
command not to do certain things, you can use the --aid
option to have the rpm
command do something nice for you. The --aid
option tells the rpm
command to add all the packages it would suggest into the set of packages to install. The rpm
command has enough information to suggest a package or packages that ought to contain the dependent files.
--aid
option depends on a separate package that contains an RPM database with all packages installed. For Red Hat Linux, this package is rpmdb-redhat
. This separate database, built as if all packages were installed (all packages that come with Red Hat Linux in this case), allows the rpm
command to search for which packages would solve dependencies.
rpm
command should run. These include pre- and post-installation scripts, as well as pre- and post-uninstallation scripts. These scripts can perform options such as automatically configuring the application based on the target environment. For example, an installation script may try to detect whether a site uses Postfix or Sendmail for transferring mail messages and configure the newly-installed package accordingly.
rpm
command will execute these scripts at the proper time, unless you explicitly turn the command to skip the scripts. The --noscripts
option tells the rpm
command to skip running the pre- and post-installation scripts.
--nopre
option tells the rpm
command to skip any pre-installation scripts. The --nopost
option tells the rpm
command to skip any post-installation scripts.
--nopreun
option tells the rpm
command to skip any pre-uninstallation scripts, and the --nopostun
option tells the rpm
command to skip any post-uninstallation scripts.
--noscripts
option is the same as turning on all these options.
Table 3.1. Skipping scripts
Option | Usage |
---|---|
--nopre
|
Skip pre-installation scripts.
|
--nopost
|
Skip post-installation scripts.
|
--nopreun
|
Skip pre-uninstallation scripts.
|
--nopostun
|
Skip post-uninstallation scripts.
|
--noscripts
|
Skip all the scripts; same as
--nopre , --nopost , --nopreun , and --nopostun .
|
rpm
command not to execute all the triggers or not to execute certain triggers. The --notriggers
option tells the rpm
command to skip all triggers.
--notriggers
. The --notriggerin
option turns off triggers during installation. The --notriggerun
option turns off uninstallation triggers, and the --notriggerpostun
option turns off the post-uninstallation triggers.
--notriggers
option is the same as all three, --notriggerin
, --notriggerun
, and --notriggerpostun
.
Table 3.2. Skipping Triggers
Option | Usage |
---|---|
--notriggerin
|
Skip installation triggers.
|
--notriggerun
|
Skip uninstallation triggers.
|
--notriggerpostun
|
Skip post-uninstallation triggers.
|
--notriggers
|
Skip all the triggers; same as
--notriggerin , --notriggerun , and --notriggerpostun .
|
rpm
command supports several ignore options that tell the command to ignore some aspect of a package it would normally complain about.
--ignorearch
option tells the rpm
command to ignore the architecture of the package and install the package, even if the architecture of the package and the architecture of your system do not match. This is a very dangerous option. Linux runs on everything from tiny wristwatches, PDAs such as the Sharp Zaurus, PCs, Macintosh PCs, RISC servers, and all the way up to huge supercomputers and mainframes. If you try to install a binary package compiled for the ARM or PowerPC processor on an Intel-architecture Linux system, the package will at best fail. At worst, it may damage parts of your system.
--ignoreos
command-line option tells the rpm
command to ignore the operating system. Again, this is likely not a good idea in most situations. Applications compiled for Windows generally won’t run on Linux. SCO Unix systems, however, can run some Linux applications, so you may have a valid reason to ignore the operating system. Again, use only with extreme care.
--ignoresize
option tells the rpm
command to ignore or skip a check of your hard disk to ensure it has enough space to install the package.
Ignoring Storage Limits
--ignoresize
option if you have a nearly full hard disk, especially for a root, or /
, partition.
--nodigest
option tells the rpm
command to skip the test of the digest, the special value that helps verify the package correctness.
--nosignature
option tells the rpm
command to skip the test of the digest, the encrypted key, that helps also verify the package correctness.
Unsafe Options
rpm
command-line options with extreme care and only after carefully considering the circumstances. Wrongful use of these options may damage your operating system.
--excludedocs
command-line option tells the rpm
command to ignore any files in the RPM package that are marked as documentation. Considering the general lack of documentation for many Linux applications, you are really asking for trouble by invoking this option. If the documentation takes up a lot of disk space, however, you may want to avoid installing documentation files. This is about the only situation in which this option makes sense.
--excludedocs
, the --includedocs
command-line parameter tells the rpm
command to install documentation. This is usually the default, so you rarely need this option.
rpm
–U
command works for both installation of new packages and for upgrading. When you get beyond simple installations, you begin to see the power of the RPM system where most operations require just one command. The rpm -U
command is a very powerful tool and performs some complex operations with just one command. For example, the following commands show the sequence for upgrading the jpilot
package, which is used for Palm PDA synchronization.
# rpm -q jpilot
jpilot-0.97-1
# rpm -U jpilot-0.99.2-8.i386.rpm # rpm -q jpilot
jpilot-0.99.2-8
jpilot
package is no longer installed. The rpm -U
command removed that package.
Uninstallation Scripts
--noscripts
option only turns off the scripts from the new package. If an old package is removed, the uninstallation scripts for the old package still get executed.
--repackage
option, which works the same as when removing packages. The --repackage
option tells the rpm
command to create a package, an RPM file, from any packages it would erase. Note that this option will not create a complete package. You will not be able to reinstall a package created by the --repackage
option. At best, the --repackage
option provides a backup of the old package, from which you could create a working package. Be careful with the --repackage
option.
--repackage
option.
rpm -U --repackage jpilot-0.99.2-8.i386.rpm
Consistent Package Names
jdk-1.3.1_01.i386.rpm
for the 1.3.1 version but changes to j2sdk-1_4_0_01-fcs-linux-i386.rpm
for the 1.4.0 version.
rpm
command really shines in the upgrade process. Not only can you upgrade a package with one simple command, but the rpm
command has some built-in smarts that really help.
rpm
command checks each file in the package. It actually compares checksums of the files. An MD5 checksum is a small value computed from the data in a file. Any change to a file results in a different checksum value.
rpm
command compares the checksums of three versions of each file: the version of the file from the old package, the version of the file in the new package, and the version of the file on disk.
rpm
command looks at all three versions of the files to handle the common case where you may have edited a configuration file on disk. This is where the rpm
command starts working with some upgrade rules. Note that this special processing only applies to files marked as configuration files within the RPM. Chapter 9, Working with Spec Files covers how to mark files as configuration files.
rpm
command simply installs the file from the new version of the package on top of the old file.
rpm
command leaves that file alone. The rpm
command makes the assumption that if the file hasn’t changed between versions of the package, and you have modified the file, chances are your file will work with the new package. This takes care of the common case where you have edited an application’s configuration files.
rpm
command installs the new version of the file on top of your changed version. This is because the new version of the file is known to work with the new package. The rpm
command saves your work by backing up your modified configuration file, renaming the file with a new .rpmsave
extension. The rpm
command also warns you that it is backing up your modified file with a message that tells you the old file name and the new file name.
%config(noreplace)
with the file, then the rpm
command will store the new file with a rpm
new extension if you have modified the file on disk.
-F
option.
rpm -F package_name
--freshen
long option in place of -F
.
rpm
command are the same, except for the -F
or --freshen
option that indicates the operation. These are the options discussed in the section on upgrading and installing software.
–i
or --install
option tells the rpm
command to run an installation operation, which, as you’d suspect, installs packages. The basic syntax is:
rpm –i filename.rpm
rpm –i jikes-1.16-1.i386.rpm
Use Upgrade, Rather Than Install
rpm
-U
, not rpm
-i
. One of the main reasons is that rpm
-i
allows you to install multiple instances of the same (identical) package. This is usually not what you want.
rpm –i
command works with the installation options discussed previously. The –U
, -F
and –i
options all accept mostly the same options, except as discussed previously.
rpm
command to install packages available on a network. With the rpm
command, you can get the packages to install by using the FTP or HTTP network protocols.
rpm
command connects to an FTP file server, downloads the named package, and installs that package. With the HyperText Transfer Protocol (HTTP) used for Web pages, the rpm
command connects to a Web server, downloads the named package, and installs that package.
Name Spoofing
rpm
command into installing a malicious package from the wrong host.
rpm
command is that you need to create a URL for the remote file name. The basic format of the command follows:
rpm -i ftp://hostname/path/to/file/filename.rpm
rpm -i ftp://www-126.ibm.com/pub/jikes/jikes-1.16-1.src.rpm
rpm
command line, the rpm
command will prompt you for the missing data.
rpm -i ftp://unclejoe@www-126.ibm.com/pub/jikes/jikes-1.16-1.src.rpm
Credentials are Examples
rpm
command will prompt you for the password. You can also include the password on the rpm
command line. Separate the user name from the password with a colon (:).
rpm -i ftp://unclejoe:workers@www-126.ibm.com/pub/jikes/jikes-1.16-1.src.rpm
rpm
command supports the HTTP protocol, used by most Web servers, as well as FTP. Similar to accessing a file via FTP, you need to pass the rpm
command a URL identifying the file. For example:
rpm –i http://ftp.redhat.com/pub/contrib/noarch/SRPMS/Squeak-sources-3-1.src.rpm
Patch Files
diff
command, and the source code is patched with the patch
command.
rpm
command is good for more than just installing and upgrading software packages. Many times, you will need to remove packages as well.
-e
option to the rpm
command, short for erase. The basic syntax follows:
rpm -e package_name
Use Package Names, Not File Names
rpm -e jikes-1.16-1
jikes-1.16-1
package used in previous examples.
root
Access is Required
root
account, or super user, to remove most packages. This is because the package files themselves are protected. In addition, the RPM database is protected.
rpm
command first checks that no other packages depend on the package you intend to remove. This is very important, since you otherwise can damage your Linux system by inadvertently removing packages needed by the rest of the system.
rpm
command supports the --test
option for removing packages as well as when installing. As with installing, the --test
option tells the rpm
command to test to see whether it can remove the given package but not to force the removal.
syslinux-1.75-3
package, you can use the --test
option to see if this works.
rpm -e --test syslinux-1.75-3
error: Failed dependencies: syslinux is needed by (installed) mkbootdisk-1.4.8-1
Alternative Option Name
--erase
, in place of –e
.
rpm
–q
command to query whether a package is installed. After running the rpm
–e
command, you can run the rpm
–q
command to check whether the package has been removed. If the rpm
–q
command shows that the package is not installed, that tells you the erase operation has worked.
# rpm -q jikes
jikes-1.16-1
# rpm -e jikes-1.16-1 # rpm -q jikes
package jikes is not installed
rpm -e aspell-en-ca-0.33.7.1-16 aspell-en-gb-0.33.7.1-16
aspell-en-ca-0.33.7.1-16
and aspell-en-gb-0.33.7.1-16
packages.
--allmatches
option tells the rpm
command to remove all packages with names that match the names you pass on the command line. If you do not use the --allmatches
option, the rpm
command will issue an error if more than one package matches the name or names you pass on the command line.
--nodeps
option tells the rpm
command to skip the test of dependencies. Use this option when you really, really, want to uninstall a package.
Unsafe Commands
rpm
command, can result in damage to your Linux system. Use these options with care.
--repackage
option, described previously, tells the rpm
command to create a package, an RPM file, from any packages it would erase. These packages will appear in the default repackage directory, which is normally /var/spool/repackage/
. Check your RPM settings to be sure of the directory configured on your system.
Repackaged Files
--repackage
option are not full packages. You cannot install these packages.
--noscripts
and --notriggers
options when removing packages. The --noscripts
option tells the rpm
command not to run any uninstallation scripts. You can refine this by using either --nopreun
or --nopostun
in place of the --noscripts
option.
--nopreun
option tells the rpm
command not to run the pre-uninstallation scripts. The --nopostun
option tells the rpm
command not to run the post-uninstallation scripts.
--notriggers
option works in a similar fashion. The --notriggers
option tells the rpm
command not to execute any triggers. For a finer grain of control, use --notriggerun
to prevent any uninstallation triggers and --notriggerpostun
to prevent any post-uninstallation triggers.
rpm
Command Options-v
(for more verbose output) work with the rpm
command for installing, removing, and upgrading packages, as well as most other uses of the rpm
command.
rpm
command options, which work with most RPM actions, include --quiet
to turn off most output except for errors, and --root
, covered previously.
--rcfile
option tells the rpm
command to use one or more other files to initialize the RPM system. These files tell the rpm
command the system architecture, operating system, and default location of the RPM database, among a host of other settings.
rc
Files
rc
comes from Unix shells, with initialization files such as .cshrc
for the C shell, csh
. The term rc
was originally a shorthand for run commands. An rc
is a file of commands that run when the application starts up. For example, the C shell, csh
, runs the commands in file named .cshrc
when the shell starts.
rpm
command, this file is .rpmrc
. The leading period makes the file hidden for most directory listings.
/etc/rpmrc
(with no leading period) that customizes the rpm
command for all users on your system. See Chapter 20, Customizing RPM Behavior for a more in-depth look at the chain of these files.
--rcfile
option is
--rcfile
filename
--rcfile
filename1:filename2:filename3
/usr/lib/rpm/rpmrc:/usr/lib/rpm/redhat/rpmrc:/etc/rpmrc:~/.rpmrc
Tilde (~) Denotes Home Directory
~/.rpmrc
means to look in the user's home directory for a file named rpmrc
.
--showrc
option to list all the rc
settings.
The --showrc
Option
--showrc
option.
--version
option tells the rpm
command to print out the version number of the command and then exit. For example:
rpm --version
RPM version 4.1
--dbpath
option, mentioned previously, tells the rpm
command to use a different RPM database. This is useful when testing a complete system install, where you want to change the RPM database but don't want that to affect your running Linux system. In this case, you can use a different RPM database and test out your changes. The basic syntax for this option is:
--dbpath
directory_name
--pipe
option tells the rpm
command to send, or pipe, its output to another program. The syntax for this option is:
--pipe
command_to_send_out_to
rpm
–e
command removes packages. The rpm
–U
command upgrades packages by installing new packages and removing old versions of all the packages upgraded. RPM upgrades also work for installing new packages. The rpm
–F
command freshens packages. This command only upgrades a package if an older version of the package has already been installed. The rpm
–i
command installs packages.
rpm
command-line options for installing, removing, and upgrading packages.
Table 3.3. Installing, Removing, and Upgrading with the rpm
command
Command | Usage |
---|---|
rpm –i install_options package_files
|
Install packages.
|
rpm –e remove_options packages
|
Erase, remove, packages.
|
rpm –U install_options package_files
|
Upgrade or install packages. Use this option for installations.
|
rpm –Uvh install_options package_files
|
Upgrade or install packages with extra output. This is the recommended command to install packages.
|
rpm –F install_options package_files
|
Freshen packages.
|
Convention
|
Usually indicates
|
Starts with g
|
GNOME desktop application or a GNU application, especially GNU C programming tools and libraries
|
Starts with j
|
Cross-platform Java application
|
Starts with k
|
KDE desktop application, Linux kernel package, or Kerberos security package
|
Starts with py
|
Python application
|
Starts with rh
|
Red Hat application, usually for configuring your system
|
Starts with tk
|
Graphical Tcl application
|
Starts with x
|
X Window System graphical desktop application
|
Ends with wm
|
Window manager for controlling the layout of windows on the screen
|
State
|
Usage
|
normal
|
The file has been installed.
|
not installed
|
The file from the package is not installed.
|
replaced
|
The file has been replaced.
|
Tag
|
Holds
|
NAME
|
Package name
|
VERSION
|
Version number
|
RELEASE
|
Release number
|
SUMMARY
|
One-line summary of the package contents
|
DESCRIPTION
|
Descriptive text about the package
|
BUILDTIME
|
Time package was built
|
BUILDHOST
|
Host package was built on
|
SIZE
|
Size of all the regular files in the payload
|
LICENSE
|
License package was released under
|
GROUP
|
Descriptive group or category name for the package
|
OS
|
Operating system package was built for
|
ARCH
|
Architecture, such as i386
|
SOURCERPM
|
The associated source RPM
|
CHANGELOGTIME
|
Array of changelog times
|
CHANGELOGNAME
|
Array of changelog names
|
CHANGELOGTEXT
|
Array of changelog text entries
|
PREIN
|
Pre-install script
|
POSTIN
|
Post-install script
|
PREUN
|
Pre-uninstall script
|
POSTUN
|
Post uninstall script
|
PLATFORM
|
Platform
|
Tag
|
Holds
|
CONFLICTFLAGS
|
Array of flags for the capabilities this package conflicts
|
CONFLICTNAME
|
Array of capabilities that this package conflicts
|
CONFLICTVERSION
|
Array of version numbers that this package conflicts
|
REQUIREFLAGS
|
Array of flags for the capabilities this package requires
|
REQUIRENAME
|
Array of capabilities that this package requires
|
REQUIREVERSION
|
Array of version numbers that this package requires
|
OBSOLETENAME
|
Array of capabilities that this package obsoletes
|
OBSOLETEFLAGS
|
Array of flags for the capabilities this package obsoletes
|
OBSOLETEVERSION
|
Array of version numbers that this package obsoletes
|
PROVIDENAME
|
Array of capabilities that this package provides
|
PROVIDEFLAGS
|
Array of flags for the capabilities this package provides
|
PROVIDEVERSION
|
Array of version numbers that this package provides
|
Tag
|
Holds
|
OLDFILENAMES
|
Array of full file names, used in older packages
|
FILESIZES
|
Array of sizes for each file
|
FILEMODES
|
Array of permissions for each file
|
FILERDEVS
|
Array of rdev values for each file
|
FILEMTIMES
|
Array of modified times for each file
|
FILEMD5S
|
MD5 checksum for each file
|
FILELINKTOS
|
Array of link information for each file
|
FILEFLAGS
|
Array of flags for each file
|
FILEUSERNAME
|
Array of user names for the file owners
|
FILEGROUPNAME
|
Array of group names for the file owners
|
FILEDEVICES
|
Array of devices for each file
|
FILEINODES
|
Array of inodes for each file
|
FILELANGS
|
Array of language flags for each file
|
DIRINDEXES
|
Array of values that matches the DIRNAMES with the BASENBAMES
|
BASENAMES
|
Array of file base names
|
DIRNAMES
|
Array of directories that matches up with BASENAMES
|
Tag
|
Holds
|
ARCHIVESIZE
|
Uncompressed size of the payload section
|
COOKIE
|
Holds an opaque string
|
RPMVERSION
|
Holds the version of the RPM tool used to create the package
|
OPTFLAGS
|
Compiler optimization flags used to build the package
|
PAYLOADFORMAT
|
Must be cpio for LSB-compliant packages
|
PAYLOADCOMPRESSOR
|
Must be gzip for LSB-compliant packages
|
PAYLOADFLAGS
|
Must be 9 for LSB-compliant packages
|
RHNPLATFORM
|
Holds an opaque string
|
FILEVERIFYFLAGS
|
Bitmask that specifies which tests to perform to verify the files after an install
|
Option
|
Meaning
|
--dump
|
Dumps out extra information on files
|
--fileid md5_id
|
Queries for the package with the given MD5 digest
|
--hdrid sha1_header_id
|
Queries for the package with the given header identifier number, in SHA1 format
|
--last
|
Reorders the output of the rpm command to show the most recently-installed packages first
|
--pkgid md5_id
|
Queries for the package with the given MD5 package ID
|
--querybynumber number
|
Queries for the given entry, by number, in the RPM database
|
--tid transaction_id
|
Queries for the package or packages with the given transaction ID
|
Network Proxy Option
|
Meaning
|
--ftpproxy proxy_hostname
|
Names the proxy system
|
--ftpport proxy_port_number
|
Network port number on the proxy system
|
--httpproxy proxy_hostname
|
Names the proxy system
|
--httpport proxy_port_number
|
Network port number on the proxy system
|
Code
|
Meaning
|
S
|
File size differs.
|
M
|
File mode differs.
|
5
|
The MD5 checksum differs.
|
D
|
The major and minor version numbers differ on a device file.
|
L
|
A mismatch occurs in a link.
|
U
|
The file ownership differs.
|
G
|
The file group owner differs.
|
T
|
The file time (mtime) differs.
|
Option
|
Usage
|
--nodeps
|
Don't verify dependencies.
|
--nodigest
|
Don't verify the package or header digests.
|
--nofiles
|
Don't verify the file attributes.
|
--noscripts
|
Don't try to verify the scripts.
|
--nosignature
|
Don't verify the package or header signatures.
|
--nolinkto
|
Don't verify the link file attribute.
|
--nomd5
|
Don't verify the MD5 digest file attribute.
|
--nosize
|
Don't verify the file size attribute.
|
--nouser
|
Don't verify the file owner attribute.
|
--nogroup
|
Don't verify the file group owner attribute.
|
--nomtime
|
Don't verify the file mtime attribute.
|
--nomode
|
Don't verify the file mode attribute.
|
--nordev
|
Don't verify the file rdev attribute.
|
-a
|
Verify all packages in a given group.
|
-g group
|
Verify all packages in a given group.
|
-p file
|
Verify the given RPM file.
|
rpmbuild
covers another option for verifying a package file, the rpm –K command.
rpmbuild
for more on building packages.
Option
|
Result
|
-v
|
increases verbosity of output (can be used multiple times)
|
-s server
|
connects to a specific rpmfind database server
|
--sources package
|
looks for source RPMs of the package
|
--apropos key word(s)
|
looks by keyword instead of package name
|
--dist dist
|
restricts packages to a specific distribution
|
--latest package
|
finds the most current version of package available
|
--upgrade package
|
finds the most current dependencies available for package
|
Site
|
Holds
|
http://plf.zarb.org/
|
The Penguin Liberation Front has RPMs that for legal reasons cannot be included in the Mandrake Linux distribution.
|
www.math.unl.edu/~rdieter/Projects/
|
Rex Dieter’s RPM site
|
www.rpmhelp.net/
|
Mandrake Linux RPMs
|
www.aucs.org/rpmcenter/
|
Edwin Chan's Red Hat RPMs
|
www.owlriver.com/projects/links/
|
Owl River Company RPMs
|
Command
|
Usage
|
?
|
displays help on the various commands
|
Help
|
displays help on the various commands
|
Info
|
displays information about an RPM
|
Fullinfo
|
displays complete information about an RPM
|
Install
|
installs RPMs onto the system
|
Add
|
adds RPMs to the queue of RPMs to be processed
|
Remove
|
deletes RPMs from the queue of RPMs waiting to be processed
|
List
|
displays all RPMs currently in the queue waiting to be processed
|
Cd
|
changes the local directory
|
Auto
|
executes commands defined in the system-wide configuration file
|
Set
|
displays or modifies current AutoRPM settings
|
Abort
|
exits without saving changes
|
Exit
|
Exits and saves changes
|
Command
|
Usage
|
autodld
|
downloads updated versions of all installed software
|
autoget
|
downloads specific RPMs from remote sites
|
autoupd
|
installs more recent versions of currently installed software
|
autoins
|
installs specific applications
|
automerge
|
merges new RPMs into an existing directory of RPMs, removing any old versions
|
autopurge
|
removes old RPMs from an existing directory of RPMs.
|
Option
|
Usage
|
--configure
|
Start a dialog for configuring up2date options
|
-d
|
Download packages but do not install them
|
-f
|
Force packages to be installed, even if they have been marked to be skipped
|
-i
|
Download and install packages
|
-l
|
List available updated versions of already installed packages
|
--showall
|
List all available packages, including packages not currently installed at all
|
-k
|
List local directories containing packages
|
--nosig
|
Disable GPG package signature checking
|
--src
|
Download both source and binary RPMs
|
--nosrc
|
Do not download source RPMs
|
-p
|
Update the list of installed packages associated with this computer in the Red Hat Network database
|
--whatprovides
|
Ask the RHN servers which packages will resolve the listed dependencies
|
--solvedeps
|
Ask the RHN servers which packages will resolve the listed dependencies, then downloads and installs those packages
|
--tmpdir
|
Specify the temporary directory to which packages should be downloaded
|
-u
|
Update all software currently installed on the system to the latest available version
|
--nox
|
Short for No X, this disables the X-based GUI, instead using only the command-line interface
|
-v
|
Provide more verbose output
|
Directory
|
Usage
|
BUILD
|
The rpmbuild command builds software in this directory.
|
RPMS
|
The rpmbuild command stores binary RPMs it creates in this directory.
|
SOURCES
|
You should put the sources for the application in this directory.
|
SPECS
|
You should place the spec file for each RPM you plan to make in this directory.
|
SRPMS
|
The rpmbuild command places source RPMs in this directory.
|
Option
|
Usage
|
-ba
|
Build all, both a binary and source RPM
|
-bb
|
Build a binary RPM
|
-bc
|
Build (compile) the program but do not make the full RPM, stopping just after the %build section
|
-bp
|
Prepare for building a binary RPM, and stop just after the %prep section
|
-bi
|
Create a binary RPM and stop just after the %install section
|
-bl
|
Check the listing of files for the RPM and generate errors if the buildroot is missing any of the files to be installed
|
-bs
|
Build a source RPM only
|
rpmbuild
covers a number of addition options for the rpmbuild command that you can use to customize the build.
Directory
|
Usage
|
BUILD
|
Where the rpmbuild command builds software
|
RPMS
|
Where the rpmbuild command stores binary RPMs it creates
|
SOURCES
|
Where you should put the sources for the application
|
SPECS
|
Where you should place the spec file
|
SRPMS
|
Where the rpmbuild command places source RPMs
|
Parameter
|
Usage
|
-a number
|
Only unpack the source directive of the given number, such as –a 0 for source0:, after changing to the directory.
|
-b number
|
Only unpack the source directive of the given number, such as –b 0 for source0:, before changing to the directory.
|
-c
|
Create directory before unpacking, used if your sources will not create the directory as part of unpacking.
|
-D
|
Do not delete the directory before unpacking.
|
-n name
|
Name the directory as name.
|
-q
|
Run quietly with minimal output.
|
-T
|
Disable the automatic unpacking of the archives.
|
Action
|
Count
|
Install the first time
|
1
|
Upgrade
|
2 or higher (depending on the number of versions installed)
|
Remove last version of package
|
0
|
Test
|
Usage
|
group
|
Verifies the group of the file
|
maj
|
Verifies the file’s major device number
|
md5
|
Verifies the file’s MD5 checksum
|
min
|
Verifies the file’s minor device number
|
mode
|
Verifies the file mode, or permissions
|
mtime
|
Verifies the file’s last modification time
|
owner
|
Verifies the owner of the file
|
size
|
Verifies the file’s size
|
symlink
|
Verifies a symbolic link
|
Macro
|
Usage
|
%dump
|
Prints out macro values
|
%{echo:message}
|
Prints message to stderr
|
%{error:message}
|
Prints message to stderr and returns BADSPEC
|
%{expand:expression}
|
Like eval, expands expression
|
%{F:file_exp}
|
Expands file_exp to a file name
|
%global name value
|
Defines a global macro
|
%{P:patch_exp}
|
Expands patch_exp to a patch file name
|
%{S:source_exp}
|
Expands source_exp to a source file name
|
%trace
|
Toggles the printing of debugging information
|
%{uncompress:filename}
|
Tests if file filename is compressed. If so, uncompresses and includes in the given context. If not compressed, calls cat to include file in given context.
|
%undefine macro
|
Undefines the given macro
|
%{warn:message}
|
Prints message to stderr
|
Macro
|
Holds
|
%0
|
The name of the macro
|
%*
|
All the parameters to the macro, except for any processed options
|
%#
|
The number of parameters
|
%1
|
The first parameter
|
%2
|
The second parameter
|
%3
|
The third parameter, and so on with %4, %5 and beyond
|
%{-p}
|
Holds -p if the -p parameter was passed to the macro; otherwise holds nothing
|
%{-p*}
|
Holds the value passed with the -p parameter, if the -p parameter was passed to the macro; otherwise holds nothing
|
%{-p:text}
|
Holds text if the -p parameter was passed to the macro; otherwise holds nothing
|
Comparison
|
Meaning
|
package < version
|
A package with a version number less than version
|
package > version
|
A package with a version number greater than version
|
package >= version
|
A package with a version number greater than or equal to version
|
package <= version
|
A package with a version number less than or equal to version
|
package = version
|
A package with a version number equal to version
|
package
|
A package at any version number
|
rpmbuild
rpmbuild
command
Option
|
Usage
|
--buildroot directory
|
Override the default root directory for building with directory, generally not very useful since most packages already name a buildroot
|
--clean
|
Remove the build tree after building
|
--nobuild
|
Just test the spec file and do not run the build
|
--rmsource
|
Remove the sources after the build
|
--rmspec
|
Remove the spec file after the build
|
--short-circuit
|
With the -bc or -bi options, jump directly to the given stage and resume the build from that stage
|
--sign
|
Sign the package with a GPG signature
|
--target platform
|
Build for the given platform. May not work if you don't have the other platform build commands, such as cross compilers, set up. Can work for Intel platforms with i386, i686, and so on.
|
Option
|
Usage
|
-ta
|
Build all, both a binary and source RPM
|
-tb
|
Build a binary RPM
|
-tc
|
Stop after the %build section
|
-tp
|
Stop after the %prep section
|
-ti
|
Stop after the %install section
|
-tl
|
Check the listing of files for the RPM
|
-ts
|
Build a source RPM only
|
Option
|
Usage
|
--nogpg
|
Don’t check for GPG signatures
|
--nomd5
|
Don’t check for MD5 signatures
|
--nopgp
|
Don’t check for PGP signatures
|
Command
|
Function
|
Ctrl+C Tab
|
Adds a new tag to the spec file
|
Ctrl+C Ctrl+F F
|
Adds a new file to the %files section
|
Ctrl+C Ctrl+F C
|
Adds a new configuration file to the %files section
|
Ctrl+C Ctrl+F D
|
Adds a new documentation file to the %files section
|
Ctrl+C Ctrl+F G
|
Adds a new ghost file to the %files section
|
Ctrl+C Ctrl+D D
|
Adds a new directory to the %files section
|
Ctrl+C Ctrl+D O
|
Adds a new documentation directory to the %files section
|
Ctrl+C Ctrl+C U
|
Changes the umask in %defattr entries in %files
|
Ctrl+C Ctrl+C O
|
Changes the owner in %defattr entries in %files
|
Ctrl+C Ctrl+C G
|
Changes the group in %defattr entries in %files
|
rpmbuild
covers signing packages.
Scripting Languages
|
Programming Languages
|
Bash (Bourne Again shell) Csh (C shell) JavaScript Ksh (Korn shell) Lua MS-DOS batch files Perl Python Ruby Sh (Bourne shell) Tcl
|
Assembler BASIC C C++ C# FORTRAN Forth Java LISP Modula-2, Modula-3 Oberon Pascal
|
Variable
|
Holds
|
$0
|
The name of the script itself, from the command line
|
$1
|
The first option
|
$2
|
The second option
|
$3
|
The third option
|
$4
|
The fourth option
|
$5
|
The fifth option
|
$6
|
The sixth option
|
$7
|
The seventh option
|
$8
|
The eighth option
|
$9
|
The ninth option
|
$*
|
All command-line options
|
$#
|
Holds the number of command-line options
|
popt
for command-line argument processing
File
|
Defines
|
rpmdb.h
|
RPM database access
|
rpmio.h
|
RPM input/output routines
|
popt.h
|
Command-line option processing
|
File
|
Defines
|
rpmts.h
|
Transaction sets
|
rpmte.h
|
Transaction elements (packages)
|
rpmds.h
|
Dependency sets
|
rpmfi.h
|
File information
|
header.h
|
Package headers
|
Library
|
Usage
|
rpm
|
Main RPM library
|
rpmdb
|
RPM database library
|
rpmio
|
RPM input/output
|
popt
|
Command-line option parsing library
|
Level
|
Usage
|
RPMMESS_FATALERROR
|
Only critical error conditions and above
|
RPMMESS_ERROR
|
Only error conditions and above
|
RPMMESS_WARNING
|
Only warning conditions and above
|
RPMMESS_QUIET
|
Same as RPMMESS_WARNING
|
RPMMESS_NORMAL
|
Only significant messages
|
RPMMESS_VERBOSE
|
Verbose informational messages
|
RPMMESS_DEBUG
|
Debugging messages, and everything above
|
Flag
|
Meaning
|
POPT_CONTEXT_NO_EXEC
|
Ignore executable expansions
|
POPT_CONTEXT_KEEP_FIRST
|
Treat argv[0], the command name, as an option
|
POPT_CONTEXT_POSIXMEHARDER
|
Do not allow options to follow arguments
|
Type
|
Value
|
Meaning
|
POPT_ARG_NONE
|
0
|
No argument data, just the option such as -v
|
POPT_ARG_STRING
|
1
|
arg treated as string
|
POPT_ARG_INT
|
2
|
arg treated as int
|
POPT_ARG_LONG
|
3
|
arg treated as long
|
POPT_ARG_INCLUDE_TABLE
|
4
|
arg points to a table
|
POPT_ARG_CALLBACK
|
5
|
arg points to a callback function
|
POPT_ARG_INTL_DOMAIN
|
6
|
sets translation domain
|
POPT_ARG_VAL
|
7
|
use value of val field for arg
|
POPT_ARG_FLOAT
|
8
|
arg treated as float
|
POPT_ARG_DOUBLE
|
9
|
arg treated as double
|
Code
|
Meaning
|
POPT_ERROR_NOARG
|
Option requires an argument, but it is missing
|
POPT_ERROR_BADOPT
|
Argument could not be parsed
|
POPT_ERROR_OPTSTOODEEP
|
Aliases are nested too deeply
|
POPT_ERROR_BADQUOTE
|
Start and end quotation marks don't match
|
POPT_ERROR_BADNUMBER
|
Argument could not be converted to a number
|
POPT_ERROR_OVERFLOW
|
Argument number was too big or too small
|
POPT_ERROR_ERRNO
|
A system call returned an error in errno
|
Code
|
RPMRC_OK
|
RPMRC_BADMAGIC
|
RPMRC_FAIL
|
RPMRC_BADSIZE
|
RPMRC_SHORTREAD
|
Type
|
Meaning
|
RPMMIRE_DEFAULT
|
Same as regular expressions but with \., .*, and ^..$ added.
|
RPMMIRE_GLOB
|
Glob-style patterns using fnmatch.
|
RPMMIRE_REGEX
|
Regular expressions using regcomp.
|
RPMMIRE_STRCMP
|
String comparisons using strcmp.
|
poptContext context; QVA_t qva = &rpmQVKArgs; rpmts ts; int ec; context = rpmcliInit(argc, argv, optionsTable); if (context == NULL) { /* Display error and exit... */ } ts = rpmtsCreate(); if (qva->qva_mode == 'q') { /* Make sure there's something to do. */ if (qva->qva_source != RPMQV_ALL && !poptPeekArg(context)) { fprintf(stderr, "no arguments given for --query"); exit(EXIT_FAILURE); } ec = rpmcliQuery(ts, qva, (const char **) poptGetArgs(context)); } ts = rpmtsFree(ts); context = rpmcliFini(context);
/* rpm --query and --verify modes in standalone program. Compile as cc -I/usr/include/rpm -o rpmq rpmq.c -lrpm -lrpmdb -lrpmio -lpopt See option usage by invoking ./rpmq --help */ #include <stdlib.h> #include <rpmcli.h> #include <rpmdb.h> #include <rpmds.h> #include <rpmts.h> /* Set up a table of options. */ static struct poptOption optionsTable[] = { { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0, "Common options for all rpm modes and executables:", NULL }, { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmQueryPoptTable, 0, "Query options (with -q or --query):", NULL }, /* Add in --verify options. */ { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmVerifyPoptTable, 0, "Verify options (with -V or --verify):", NULL }, POPT_AUTOALIAS POPT_AUTOHELP POPT_TABLEEND }; int main(int argc, char * argv[]) { poptContext context; QVA_t qva = &rpmQVKArgs; rpmts ts; int ec; context = rpmcliInit(argc, argv, optionsTable); if (context == NULL) { poptPrintUsage(context, stderr, 0); exit(EXIT_FAILURE); } ts = rpmtsCreate(); /* Check for query mode. */ if (qva->qva_mode == 'q') { /* Make sure there's something to do. */ if (qva->qva_source != RPMQV_ALL && !poptPeekArg(context)) { fprintf(stderr, "no arguments given for --query"); exit(EXIT_FAILURE); } ec = rpmcliQuery(ts, qva, (const char **) poptGetArgs(context)); } /* Check for verify mode. */ else if (qva->qva_mode == 'V') { rpmVerifyFlags verifyFlags = VERIFY_ALL; /* Verify flags are negated from query flags. */ verifyFlags &= ~qva->qva_flags; qva->qva_flags = (rpmQueryFlags) verifyFlags; /* Make sure there's something to do. */ if (qva->qva_source != RPMQV_ALL && !poptPeekArg(context)) { fprintf(stderr, "no arguments given for --verify"); exit(EXIT_FAILURE); } ec = rpmcliVerify(ts, qva, (const char **) poptGetArgs(context)); } else { poptPrintUsage(context, stderr, 0); exit(EXIT_FAILURE); } ts = rpmtsFree(ts); context = rpmcliFini(context); return ec; }
Class
|
Covers
|
rpm
|
RPM base module into RPM API
|
rpmts
|
Transaction sets
|
rpmte
|
Transaction elements, a package in a transaction set
|
rpmmi
|
Match iterators, used for querying the RPM database
|
Rpmds
|
Dependency set
|
Rpmfi
|
File into set
|
Header
|
A package header
|
Type
|
Meaning
|
rpm.RPMMIRE_DEFAULT
|
Same as regular expressions, but with \., .*, and ^..$ added
|
rpm.RPMMIRE_GLOB
|
Glob-style patterns using fnmatch
|
rpm.RPMMIRE_REGEX
|
Regular expressions using regcomp
|
rpm.RPMMIRE_STRCMP
|
String comparisons using strcmp
|
Flag
|
Meaning
|
rpm.RPMVSF_NEEDPAYLOAD
|
Leave the file handle positions at the beginning of the payload.
|
rpm.RPMVSF_NOHDRCHK
|
Don’t check the RPM database header.
|
rpm.RPMVSF_ NODSA
|
Don’t check the header and payload DSA signatures.
|
rpm.RPMVSF_ NODSAHEADER
|
Don’t check the header DSA signature.
|
rpm.RPMVSF_ NOMD5
|
Don’t check the header and payload MD5 digests.
|
rpm.RPMVSF_ NORSA
|
Don’t check the header and payload RSA signatures.
|
rpm.RPMVSF_ NOSHA1HEADER
|
Don’t check the header SHA1 digest.
|
rpm._RPMVSF_NODIGESTS
|
Convenience to not check digests.
|
rpm._RPMVSF_NOSIGNATURES
|
Convenience to not check signatures.
|
Method
|
Returns
|
A
|
Returns package architecture
|
E
|
Returns package epoch
|
O
|
Returns package operating system
|
R
|
Returns package release number
|
V
|
Returns package version
|
N
|
Returns package name
|
NEVR
|
Returns package name-epoch-version-release
|
DS
|
Returns the package dependency set for a given tag
|
FI
|
Returns the file info set for the package
|
Value
|
Reason
|
rpm.RPMCALLBACK_UNKNOWN
|
Unknown problem
|
rpm.RPMCALLBACK_INST_PROGRESS
|
Progress for installation
|
rpm.RPMCALLBACK_INST_START
|
Start of installation
|
rpm.RPMCALLBACK_INST_OPEN_FILE
|
Callback should open package file
|
rpm.RPMCALLBACK_INST_CLOSE_FILE
|
Callback should close package file
|
rpm.RPMCALLBACK_TRANS_PROGRESS
|
Transaction progress
|
rpm.RPMCALLBACK_TRANS_START
|
Transaction start
|
rpm.RPMCALLBACK_TRANS_STOP
|
Transaction stop
|
rpm.RPMCALLBACK_UNINST_PROGRESS
|
Uninstallation progress
|
rpm.RPMCALLBACK_UNINST_START
|
Uninstallation start
|
rpm.RPMCALLBACK_UNINST_STOP
|
Uninstallation stop
|
rpm.RPMCALLBACK_REPACKAGE_PROGRESS
|
Repackaging progress
|
rpm.RPMCALLBACK_REPACKAGE_START
|
Repackaging start
|
rpm.RPMCALLBACK_REPACKAGE_STOP
|
Repackaging stop
|
rpm.RPMCALLBACK_UNPACK_ERROR
|
Error unpacking package file
|
rpm.RPMCALLBACK_CPIO_ERROR
|
cpio error getting package payload
|
Routine
|
Usage
|
find_all()
|
Returns a list with all the packages in the database
|
find_all_iter()
|
Returns an iterator over all the packages in the database
|
find_by_file($filename)
|
Finds all packages that own the given file, returning a list
|
find_by_file_iter($filename)
|
Finds all packages that own the given file, returning an iterator
|
find_by_name($package_name)
|
Finds all packages with the given name, returning a list
|
find_by_name_iter($package_name)
|
Finds all packages with the given name, returning an iterator
|
find_by_provides($capability)
|
Finds all packages that provide the given capability, returning a list
|
find_by_provides_iter($capability)
|
Finds all packages that provide the given capability, returning an iterator
|
find_by_requires($capability)
|
Finds all packages that require the given capability, returning a list
|
find_by_requires_iter($capability)
|
Finds all packages that require the given capability, returning an iterator
|