3.9 RPM management

 <  Day Day Up  >  

Red Hat Packet Manager (RPM) is a standard software packaging format in SuSE and all Red Hat-based distributions. [17]

[17] For more information on building your own RPMs, see: http://www-106.ibm.com/developerworks/linux/library/l-rpm1/ or Maximum RPM

3.9.1 Naming convention

The RPM naming convention has the following format: name-version-release.arch.rpm. If we take screen-3.9.13-23.ppc.rpm as an example, we see the name of the software package: screen, version:3.9.13 and release:23. The last section, ppc, indicates that this RPM is build for the PowerPC plattform.

3.9.2 Querying RPM

We have two RPM querying possibilities: querying a package we have not installed yet, and querying an installed software package. Most options are the same for both queries, but the command syntax is different. Some options can only be used for one of the queries.

To query a package that is not installed (an RPM file):

  rpm -q OPTIONS -p name-version-release.arch.rpm  

Always add the -p option for a package that is not installed, as shown in Example 3-21.

Example 3-21. rpm querying rpm-file
  # rpm -qi -p screen-3.9.13-23.ppc.rpm  Name        : screen                       Relocations: (not relocateable) Version     : 3.9.13                            Vendor: SuSE Linux AG, Nuernberg, Germany Release     : 23                            Build Date: Tue Nov 12 01:38:51 2002 Install date: (not installed)               Build Host: sweetie.suse.de Group       : System/Console                Source RPM: screen-3.9.13-23.src.rpm Size        : 633585                           License: GPL Packager    : http://www.suse.de/feedback Summary     : Multi Screen on a VT100/ANSI Terminal Description : With this program you can take advantage of the multitasking abilities of your Linux system by opening several sessions over one terminal. The sessions can also be detached and resumed from another login terminal. Documentation: man page Authors: --------     Oliver Lauman     Juergen Weigert   <jnweiger@immd4.informatik.uni-erlangen.de>     Michael Schroeder <mlschroe@immd4.informatik.uni-erlangen.de> 

To gather information about installed packages we do not provide the full RPM name with version, release and architecture; instead, we only use the name of the software:

  rpm -q OPTIONS name  

This is shown in Example 3-22.

Example 3-22. rpm: querying installed rpm package
  # rpm -qi rsync  Name        : rsync                        Relocations: /usr Version     : 2.5.6                             Vendor: Red Hat, Inc. Release     : 20                            Build Date: Tue 05 Aug 2003 03:52:53 PM EDT Install Date: Thu 06 Nov 2003 05:00:36 PM EST      Build Host: cure81.devel.redhat.com Group       : Applications/Internet         Source RPM: rsync-2.5.6-20.src.rpm Size        : 263593                           License: GPL Signature   : DSA/SHA1, Wed 24 Sep 2003 01:24:57 PM EDT, Key ID 219180cddb42a60e Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> Summary     : A program for synchronizing files over a network. Description : Rsync uses a reliable algorithm to bring remote and host files into sync very quickly. Rsync is fast because it just sends the differences in the files over the network instead of sending the complete files. Rsync is often used as a very powerful mirroring process or just as a more capable replacement for the rcp command. A technical report which describes the rsync algorithm is included in this package. 

Table 3-4 lists options for querying RPMs; refer to the rpm man page for more information.

Table 3-4. RPM query options

RPM query option

Purpose

rpm -q -i

Information: package description, packager, build and install date

rpm -q -l

File list

rpm -q -s

File list with state: the state of each file is either normal, not installed, or replaced .

rpm -q -d

List of documentation files.

rpm -q -c

List of configuration files.

rpm -q --requires

List of packages or files on which this package depends.

rpm -q --provides

List what this package provides.

--checksig

Check signature (only for package).

rpm -qf /filename

Which package installed the provided file.

rpm -qilf /filename

Which package installed the provided file, what it does, and which files belong to it.

rpm -qdf /filename

Show all documentation installed on the provided file or RPM it belongs to.

rpm -qa

List all rpms installed.

rpm -Va

Which files in my system are modified missing or replaced (this takes a long time).

rpm -Vv name

Which files from the given package are modified or missing?

rpm --rebuilddb

Everything is broken, please rebuild the rpm database (backup the /var/lib/rpm directory first!)

RPM maintains a database in /var/lib/rpm, and this database grows, especially after system updates. It might be helpful to rebuild the database (backup the /var/lib/rpm directory first). On our test system, rpm --rebuilddb decreased the size of the /var/lib/rpm directory from 70 to 22 Megabytes.

To verify and monitor changes in the system, rpm -V package or a can be used. It uses the database and displays all files changed since installation for the given package, or for the entire system, if the -a option is provided, as shown in Example 3-23 on page 138.

Example 3-23. using rpm -V samba
 # rpm -V samba S.5....T c /etc/pam.d/samba S.5....T c /etc/samba/smbpasswd 

RPM displays 8 characters in front of the changed file name with the following meanins:

  • S size

  • 5 MD5-checksum

  • L symbolic link

  • D device

  • U user

  • G group

  • M modus (permissions)

  • T modification time

3.9.3 Installing and uninstalling RPMs

If you want to install some third party RPMs, first query them and make sure they apply to your architecture (ppc) or are architecture-independent (noarch), then verify that they can be installed on your distribution.

As for querying, we need a full RPM file name (name-version-release.arch.rpm) if we are going to install it, but we only need the package name (name) if we are uninstalling it. Table 3-5 lists examples for RPM installation and uninstallation.

Table 3-5. RPM installation

Command

Purpose

rpm -ivh packagename.rpm

Install package, be verbose and show hash

rpm -Uvh

Install package that is already installed (upgrade)

rpm -Fvh *rpm

Install only those newer rpms that are already present on the system (freshen)

rpm -e packagename

Uninstall rpm

RPMs are always distributed as a full package, not as an update package. If for some reason you need to downgrade an RPM to the level you used before upgrading, you need to uninstall it and reinstall the older RPM. If you are not able to uninstall an RPM because of other packages depending on it, use the --nodeps option when uninstalling, and reinstall the older version immediately.

Surprisingly, on SuSE SLES, YaST can be used to install RPMs on the command line, and under some circumstances it resolves dependencies automatically. If you call yast -i shortrpmname it will try to resolve dependencies of the package.

If your system has any unresolved dependencies (not necessarily related to this package), then the command will become interactive and ask what to do with the unresolved dependency conflict.

If the system is in good condition and the installation CD (or other directories provided in yast inst_source ) is accessible, then YaST will install the package requested and even resolve its dependencies if they are resolvable through other packages present in the installation source.

If we call yast -i fullpackagename , then YaST will just install the RPM. It acts like rpm -U . It will fail just like rpmif the dependencies of the package are unresolved.

 <  Day Day Up  >  


Quintero - Deploying Linux on IBM E-Server Pseries Clusters
Quintero - Deploying Linux on IBM E-Server Pseries Clusters
ISBN: N/A
EAN: N/A
Year: 2003
Pages: 108

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net