SDB:Rpm - The package manager of SuSE Linux

Şuraya atla: kullan, ara


Version: 5.0

Starting with version 5.0 »rpm« (Red Hat Package Manager) became part of the SuSE Linux distribution. This way package management is much easier for all involved people : Users, system administrators and - last, but not least - those that create packages. The powerful RPM database provides detailed information about the installed software.

In principle rpm can operate in three different modes :

  • Create installable packages from the pristine sources,
  • install and deinstall or update these packages
  • and get information from the RPM database or about single RPM archives.

The last two points will be discussed now.

Installable RPM archives are packaged in a special binary format. These archives consist of the (program-)files, that should be installed and of different meta information that are being used during the installation by rpm (in order to configure a software package or to be stored for documentation purposes in the RPM database). RPM archives end on the suffix .rpm.

Administering packages : Installing, updating and uninstalling :

The installation of an RPM archive is usually as simple as

        rpm -i PACKAGE.rpm

However the package will only get installed with this command, if all "dependencies" are fulfilled and if there will be no "conflicts". rpm asks (through an error message) for the packages that are necessary to fulfill all dependencies. The database checks in the background, that no conflicts arise : A file may normally only belong to one single package. However you can override this rule with a couple of options. Please note, that in this case you should know exacty, what you are doing. This way you might endager the possibility to update a specific package.

The option -U resp. --upgrade is interesting, if you want to update a package. An older version of the same package gets erased, then the new version gets installed. rpm will try to handle configuration files carefully at the same time. The following strategy is being used :

  • If a configuration file was not changed by the system administrator, the new version of this file gets installed by rpm. No intervention by the administrator is necessary.
  • If the configuration file was changed by the administrator before the update, then rpm will only backup the changed file with the suffix .rpmorig and install the new version of the RPM package, if there were changes between the original file and the one contained in the update package. It is likely that you must adapt the newly installed configuration file to the needs of your system according to the backup (.rpmorig). It is highly recommended to remove all .rpmorig files afterwards so they won't hinder future updates.

After every update you must check the backup copies created by rpm (with suffix .rpmorig); these are your old configuration files. If necessary you must enter your changes of the .rpmorig-files into the new configuration files manually. Then erase the old files with the suffix .rpmorig

If you want to remove a package, simply enter

rpm -e PAKET

However rpm will only remove a package, if no dependencies exist. For example it is impossible to remove TCL/TK while some other software needs these programs. RPM checks this with the help of its database.

If it is impossible to erase a package even though no dependencies exist anymore, it might help to rebuild the RPM database with the option --rebuilddb (see the hints under SDB:rpm - The package manager of SuSE Linux#db RPM database below).

Enquiries :

The option -q (aka query) starts an enquiry. It can be used to scan both RPM archives (option -p PACKAGE_FILE) and the RPM database. You can specify the desired information with additional switches :

-i
shows package informations
-l
shows the packages file list
-f FILE+
shows the package, that owns the file FILE . FILE must be given with its full path !
-s
Status of the files (implies -l)
-d
Shows only documentation files (implies -l)
-c
Shows only configuration files (implies -l)
--dump
Shows all checkable informations for each file (use with -l, -c or -d !)
--provides
shows package features
--requires, -R
shows dependencies of the package.
--scripts
shows the various (un-)install scripts

For example the command

        rpm -q -i rpm

displays the following information :

Name        : rpm                     Distribution: SuSE Linux
Version     : 2.4.1                         Vendor: SuSE GmbH
Release     : 1                         Build Date: Wed Jun 18 14:46:53 1997
Install date: Sat Jun 21 12:01:21 1997  Build Host: Fibonacci.suse.de
Group       :                           Source RPM: rpm-2.4.1-1.src.rpm
Size        : 1365662
Packager    : feedback@suse.de
URL         : (none)
Summary     : Red Hat Package Manager
Description :
RPM is a powerful package manager, which can be used to build, install,
query, verify, update, and uninstall individual software packages. A
package consists of an archive of files, and package information,
including name, version, and description.

The option -f only works, if you know the complete filename including the path. An arbitrary number of files can be specified, e.g.

        rpm -q -f /bin/rpm /usr/bin/wget

returns

        rpm-2.4.1-1
        wget-1.4.5-2

If you only know part of the filename, you must use a shell script like the following (the filename must be given to the script as a parameter) :

        #! /bin/sh
        for i in `rpm -q -a -l | grep  $1 `; do
            echo »$i« is in package:
            rpm -q -f $i
            echo ""
        done

The database can be used for verification purposes. Scun enquiries start with the option -V (same as -y or --verify). With these options rpm will show you all those files, that were changed compared to the original version contained in the package. rpm displays up to 8 characters in front of the filename which indicate the following changes :

5
MD5-checksum
S
filesize
L
symbolic link
T
modification time
D
device
U
user
G
group
M
modus (including permissions und type)

For configuration files a c will be shown in addition. E.g. if /etc/wgetrc (from wget) was changed :

        rpm -V wget
        S.5....T c /etc/wgetrc

About the database :

The files of the RPM database can be found under /var/lib/rpm. A /usr partition of 500 MB can easily use 20 MB of disk space, especially after a complete update. If the database seems to be too big, it might help to create a new database from the existing one using the option --rebuilddb. However it is wise to create a backup copy of the old database before.

Furthermore the cron-script cron.daily creates a compressed copy of the database under /var/adm/backup/rpmdb every day, if there were changes.The number of existing copies of the database can be specified with the variable MAX_RPMDB_BACKUPS (default : 5) in /etc/rc.config. Expect up to 3 MB for each backup (with 500 MB in /usr).You must take this diskspace into account when specifying the size of the root-partition (unless you give /var its own partition).

Tools for RPM archives :

The Midnight Commander (mc) is able to show the content of RPM archives or to copy parts of them to another location. It shows the content of such an archive in the form of a virtual filesystem, so all usual controls of the Midnight Commander are available (if useful) : The headline of the "file" HEADER can be viewed with F3. You can "browse" the archive with cursor-keys and Enter, components of the archive can be copied to another location (outside of the archive) with F5. BTW, Emacs doesn't do this, so far ;-)

With Alien (alien) the package formats of different distributions can be converted. This way you can try to convert TGZ archives into RPM before the installation, so the RPM database gets the package information. However be careful : alien is a Perl script which is (according to the authors) still in the alpha stage although its version is currently (5.2) already 5.19 .

<keyword>rpm,packagemanager,package,install,update</keyword>