4 Using RPM

Contents of this section

In its simplest form, RPM can be used to install packages:

        rpm -i foobar-1.0-1.i386.rpm
The next simplest command is to uninstall a package:
        rpm -u foobar

One of the more complex but highly useful commands allows you to install packages via FTP. If you are connected to the net and want to install a new package, all you need to do is specify the file with a valid URL, like so:

        rpm -i ftp://ftp.pht.com/pub/linux/redhat/rh-2.0-beta/RPMS/foobar-1.0-1.i386.rpm

Please note, however, that the current version of RPM will only do installs via FTP. You cannot run any of the more complex query options on packages at an FTP site.

While these are simple commands, rpm can be used in a multitude of ways as seen from the Usage message:

rpm version 1.0
Copyright (C) 1995 - Red Hat Software
This may be freely redistributed under the terms of the GNU Public License

    Usage:
   --help               - print this message
    -q                  - query mode
      Package specification options:
        -a                - query all packages
        -f <file>+        - query package owning <file>
        -F                - like -f, but read file names from stdin
        -p <packagefile>+ - query (uninstalled) package <packagefile>
        -P                - like -f, but read package names from stdin
      Information selection options:
        -i                - display package information
        -l                - display package file list
        -s                - show file states (implies -l)
        -d                - list only documentation files (implies -l)
        -c                - list only configuration files (implies -l)

    -V
    -y
    --verify            - verify a package installation
                          same package specification options as -q

    --install <packagefile>
    -i <packagefile>    - install package
       -v               - be a little verbose 
       -h
      --hash            - print hash marks as package installs (good with -v)
      --percent         - print percentages as package installs
      --force           - install despite potential conflicts
      --test            - don't install, but tell if it would work or not

    --upgrade <packagefile>
    -U <packagefile>    - upgrade package (same options as --install)

    --uninstall <package>
    -u <package>        - uninstall package

    -b<stage> <spec>    - build package, where <stage> is one of:
                          p - prep (unpack sources and apply patches)
                          l - list check (do some cursory checks on %files)
                          c - compile (prep and compile)
                          i - install (prep, compile, install)
                          b - binary package (prep, compile, install, package)
                          a - bin/src package (prep, compile, install, package)
      --short-circuit   - skip straight to specified stage (only for c,i)
      --clean           - remove build tree when done
      --keep-temps      - do not delete scripts (or any temp files) in /tmp
      --test            - do not execute any stages, implies --keep-temps
                          in /tmp - useful for testing
      --time-check <s>  - set the time check to S seconds (0 disables it)

First, I'll go through a synopsis of what all the options mean (don't worry, there may be alot of options, but we tried to make them all as intuitive as possible).

Options are nested, so the possible options are many. Here's a description in parallel with the Usage message:

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter