= RPM How-To for end users = [[PageOutline]] This section contains basic informations for end users about installing, upgrading and removing packages with YUM and RPM. == Handy YUM and RPM commands YUM is a command line tool used to install software packages from the remote repositories which involves automatic downloading of package files and all their requirements, subsequent unpacking and unattended installation of the package contents to the appropriate system directories. This tool is ideal for end users. Everything you need to know is a name of the package you want to install. ||'''yum install''' __pkg__ ||Install the latest version of the package named __pkg__ (including all packages it needs for its work, if any) ||'''yum reinstall''' __pkg__ ||Reinstalls the latest version of the package named __pkg__ (including all packages it needs for its work, if any) ||'''yum remove''' __pkg__ ||Uninstall the package named __pkg__ (including all installed packages that need the removed one, if any) ||'''yum downgrade''' __pkg__ ||downgrades the package named __pkg__ one version ||'''yum check-update''' ||List available updates (newer versions) for all installed packages ||'''yum update''' ||Install all available updates (if any) ||'''yum update''' __pkg__ ||Update only the package named __pkg__ (and packages it needs, if newer versions of them are required) ||'''yum info''' __pkg__ ||Show information about the package named __pkg__ ||'''yum search''' foobar ||Show all packages containing "foobar" in the name, summary or description fields ||'''yum list installed''' ||List all installed packages ||'''yum list available''' foo* ||List all available packages with names starting with "foo" ||'''yum list''' *bar* ||List all packages containing "bar" in names (both installed and available) ||'''yum clean packages''' ||Delete all downloaded files containing installed packages (packages themselves are not uninstalled) ||'''yum clean metadata''' ||Delete RPM repository cache files (useful if you get strange errors about missing packages) RPM is a low-level tool used to perform operations on package files directly and also to query the local database of installed packages in cases where YUM doesn't provide the required information. End users rarely need to use this tool. ||||'''rpm -i''' __pkg-XYZ__.rpm ||Install the package contained in the file "__pkg-XYZ__.rpm" (all required packages must be already installed) ||||'''rpm -i --nodeps''' __pkg-XYZ__.rpm ||Install the package contained in the file "__pkg-XYZ__.rpm" w/o checking for dependencies (only use that when you know exactly what you do) ||'''rpm -qi -p''' __pkg-XYZ__.rpm ||'''rpm -qi''' __pkg__ ||Display information about the package file "__pkg-XYZ__.rpm" or about the installed package __pkg__ (name, version, etc.) ||'''rpm -qR -p''' __pkg-XYZ__.rpm ||'''rpm -qR''' __pkg__ ||Display the requirements of the package file "__pkg-XYZ__.rpm" or the installed package __pkg__ ||'''rpm -ql -p''' __pkg-XYZ__.rpm ||'''rpm -ql''' __pkg__ ||List all files contained in the package file "__pkg-XYZ__.rpm" or the installed package __pkg__ ||'''rpm -q --changelog -p''' __pkg-XYZ__.rpm ||'''rpm -q --changelog''' __pkg__ ||Print the list of changes provided by the version of the package contained in "__pkg-XYZ__.rpm" or by the installed package __pkg__ ||||'''rpm -qf''' /full/path/to/file ||Search for an installed package owning the file "/full/path/to/file" (e.g. "/@unixroot/bin/sh") ||||'''rpm -q --whatrequires''' file ||Search which package needs "file" (e.g. "libc066.dll") You may find more detailed information about YUM and RPM using the following links: * YUM command manual page: http://linuxcommand.org/man_pages/yum8.html * RPM command manual page: http://www.rpm.org/max-rpm-snapshot/rpm.8.html * YUM website: http://yum.baseurl.org/ * RPM website: http://www.rpm.org/ == Swapping alternate packages == There are packages that provide identical functionality using a different set of programs. Often such alternate packages cannot be installed together because they provide identical file names or need exclusive access to some other resources. If you try to install one package without first removing another, RPM will complain. So, in order to swap such packages — usually, to switch between various implementations of the given functionality — you first need to remove one package and then install another one. However, there may be other packages that depend on the provided functionality and if any of these dependent packages is already installed when you try to remove one of the alternatives, RPM will not let you do that too. Let's assume a real world example. You want to switch from the `ash-sh` package (that provides the original NetBSD version of the POSIX shell) to the `dash-sh` package (that provides the Debian flavour of NetBSD shell). Both of these packages install a file called `/@unixroot/usr/bin/sh.exe` and you will surely have many packages that depend on that file (basically, any package that contains shell scripts) already installed, so two separate install-remove steps won't work. You need a special command to perform such a swap. The current version of `yum` lacks a one-line command for this operation but there is an easy way to do using the interactive Yum Shell. Here is how to switch from `ash-sh` to `dash-sh` using this approach (commands you that type in are the ones after the `>` prompt): {{{ D:>yum shell Setting up Yum Shell > remove ash-sh Setting up Remove Process > install dash-sh Setting up Install Process > run > exit }}} You may swap any conflicting packages using this algorithm provided that the resulting package configuration does not leave any unresolved package dependencies. == Platform selection for binaries == The default base architecture setting for RPM/YUM is the i686 platform; if you own a Pentium4 CPU (and above), you can tell YUM to inspect P4 package list first, and fallback to i686 if none found. To enable P4, create a 'platform' text file in your %UNIXROOT%\etc\rpm directory with the following text in it: {{{ pentium4-OS/2-OS/2 }}} Access to pentium4 packages requires the latest YUM package.[[BR]] '''If YUM doesn't find any packages for you and you never added a platform file, you have a too old os2-base package. To overcome that please do a''' {{{ yum update os2-base }}} Additional information concerning the platform file may be found in [http://www.redhat.com/archives/rpm-list/2002-June/msg00082.html this announcement] from the rpm mailing list. == Local RPM repository == Sometimes you may want to maintain a local repository of RPM packages (for example, if you want to organize your specific software or private data using RPM which you don't want to put to public RPM repositories) . This is fairly easy: 1. Install the createrepo package. 2. Add a file local.repo to /etc/yum/repos.d/ that contains: {{{ [local] name = My local repo #baseurl = file:x%3A/ baseurl = file:x/ enabled=1 }}} 3. Put your .rpm files to x:/. The online repository is located here: * http://rpm.netlabs.org/experimental/00/i386/ * http://rpm.netlabs.org/release/00/i386/ please get files from i386 (or i686 or pentium4) and noarch subdirectories. 4. Execute {{{ sh -c "createrepo x:/" }}} As YUM didn't understand the : after our drive letter, we need to use the %3A instead. This is the : in a URI. With the recent python build it understands drive letters, so the above %3A hack isn't needed anymore. The x above stands for any drive, where you want to store your local rpm. stands for the local directory. As example:[[br]] when your local repo is at q:\rpmbuild\localrepo, then you have to add in the local.repo file {{{baseurl = file:q:/rpmbuild/localrepo}}} and for createrepo it is {{{sh -c "createrepo q:/rpmbuild/localrepo"}}} == Note about upgrading from 2010 RPM builds == Newer RPM builds are now using Berkeley DB for storing package informations, while previous builds were using SQLite 3 for this task. Since SQLite support is being phased out, RPM moved to Berkeley DB. After updating you need to convert the old database to the new format: you can check this running {{{ rpm -qa }}} at the command prompt; you will get a SIGSEV error or a message about wrong database format: {{{ [E:\]rpm -qa rpmdb: __db_meta_setup: /@unixroot/var/lib/rpm/Packages: unexpected file type or format error: cannot open Packages index using db3 - Invalid argument (22) error: cannot open Packages database in /@unixroot/var/lib/rpm rpmdb: __db_meta_setup: /@unixroot/var/lib/rpm/Packages: unexpected file type or format error: cannot open Packages database in /@unixroot/var/lib/rpm }}} To upgrade the database, use the following command sequence: {{{ rpm --define '_dbapi 4' --rebuilddb mv /@unixroot/var/lib/rpm /@unixroot/var/lib/rpm.bak mv /@unixroot/var/lib/rpm.rebuild /@unixroot/var/lib/rpm }}} You can test operation running {{{ rpm -qa }}} you will get the list of installed packages. The older SQLite databases are now saved into mv /@unixroot/var/lib/rpm.bak, if everything is ok you can delete this directory.