Ict-innovation/LPI/102.5

= 102.5 RPM and YUM Package Management = Candidates should be able to perform package management using RPM based tools.

Key Knowledge Areas


 * Install, re-install, upgrade and remove packages using RPM and YUM.
 * Obtain information on RPM packages such as version, status, dependencies, integrity and signatures.
 * Determine what files a package provides, as well as find which package a specific file comes from.

Introduction
Some Linux distribution uses rpm the “Red Hat Package Manager” for all its distribution software. RPM maintains a detailed database of all software installed in the system.

RPM Package Naming

There is no strict convention but most rpm package names are formed as follows:

name-version-release.architecture.rpm

The architecture name can either indicate which computer architecture the enclosed binaries are made for (e.g i386, ppc, ia64, noarch) or it can indicate that the package contains the source code (src).

Major and minor modes

Some short name options are similar but perform different actions depending on their position on the command line. A distinction is made between the first option and other options.

The first option given to rpm is in major mode. For example in rpm -iv A.rpm the option 'i' is a major option and will cause package A to be installed.

Similarly an option that is not in first position is in minor mode. For example in rpm -qpi A.rpm the option 'i' is a minor mode and will get information from the package A such as the author and the licence type.

These are the major mode options for rpm.

These are the minor mode options for rpm.

Query modes

Three query types: uninstalled packages, installed packages and files

An extra option will allow you to get information on all installed files –l, documentation –d configuration files –c, etc ...

We consider for example the package routed-0.17.i386.rpm. We can query this package and list its contents before installation with the l option as follows:

Once this package is install we can query the installed package with:

Finally if we want to find out which package installed the file /usr/sbin/routed the rpm database can be queried with:

Special Options

--nodepsInstall a package regardless of dependencies

--force force an upgrade

--testdoesn’t actually install or upgrade, just prints to stdout

--requires PACKAGEtogether with q lists capabilities required by a package

--whatrequires CAPABILITYtogether with q lists packages which require the capability

Package Signatures

You can check the signature of each package that is distributed as part of a project. For example to load the keys of all the developers involved with the Fedora project do the following (just once):

You can now download any package from an FTP site which mirrors the project's RPMs. For example we downloaded zlib-1.2.1.1-2.1.i386.rpm from ftp.mirror.ac.uk in the Fedora subdirectory. We next check the authenticity of the file:

Package Integrity

The next command checks the integrity of the package bash:

This returns nothing. We next do the following as user root:

If we check the integrity of bash again this time we get:

The package manager has compared the current status of all files which are part of the bash package with the known original state of these files stored in a database. The changes made to /bin/bash have been identified.

It is possible to verify the integrity of all packages installed on the system by adding the 'a' (--all) option after 'V' (--verify)

The –verify option performs a number of tests on each file; when a test is positive a number of characters (listed below) are used to identify the errors:

Yum Package Manager
Yum is the default package manager for many rpm based distributions that allows for the installing, updating and removing of rpm packages without having to worry about resolving dependencies yourself. Yum uses external repositories to provide the meta-data, in the form of index files, about what packages are available and their dependencies as well as to store the rpm packages that will be automatically downloaded to fulfil an installation request. A repository may be an web site or directory that is formatted in the manner expected by yum.

The most common command for yum are:

install – install a package, automatically resolving and installing dependencies. The command below would install the tsclient package with its dependencies.

This comand will install all software packages in the “mysql database group”, which will include the mysql server as well as admin and management tools

update – update the list of available packages and will update all installed packages on your system to the latest available versions.

search – search the list of available rpm packages. The command below will search for a package by name.

If you do not know the name of the package, which is often the case, you can search for a package by keyword. The search command can also accepts wildcards in its search criteria.

erase/remove – delete a package from your system. Erase is a safer option to use as remove may delete dependencies that are needed by other packages. Below we remove he tsclient package

We can also remove all packages in a group.

Yum is configured in the /etc/yum.conf file and repositories are managed via the /etc/yum.repos.d/ directory. To add an extra repository, place a definition file in the /etc/yum.repos.d/ directory on your system. Package providers make the definition files for their repositories available on their web sites. You may also create a repository file manually by following the correct file format. To disable a repository you can add the line enable=0 to the repository definition file. If you wish to permanently remove the repository delete the definition file and clear the yum cache directory /var/cache/yum/. The cache directory is updated each time you run “yum update”

The yumdownloader is a program for downloading RPMs from Yum repositories. It is used to download the rpm packages without installing them on the system. This can be useful for downloading packages from a faster connection and then copying then to a machine with a slower connection for installation. The parameters that are commonly used with the yum downloader are:


 * destdir DIR - specify a destination directory for the download. Defaults to the current directory.
 * resolve When downloading RPMs, resolve dependencies and also download the required packages.

Used files, terms and utilities:* rpm
 * rpm2cpio
 * /etc/yum.conf
 * /etc/yum.repos.d/
 * yum
 * yumdownloader

Previous Chapter | Next Chapter