wiki:RpmHowToEndUsers

Version 19 (modified by Silvan Scherrer, 10 years ago) ( diff )

--

RPM How-To for end users

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 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 -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:

Platform selection for binaries

The default base architecture setting for RPM/YUM is the i386 platform; if you own a i686 CPU (PentiumPro and above), you can tell YUM to inspect i686 package list first, and fallback to i386 if none found. To enable i686, create a 'platform' text file in your %UNIXROOT%\etc\rpm directory with the following text in it:

i686-OS/2-OS/2

Binaries are getting built also for Pentium4 and above processors, use the following text to enable this:

pentium4-OS/2-OS/2

Access to pentium4 packages requires the latest YUM package.

Additional information concerning the platform file may be found in 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://<path_to_repo>
    enabled=1
    
  3. Put your .rpm files to <path_to_repo>. The online repository is located here:

please get files from i386 (or i686 or pentium4) and noarch subdirectories.

  1. Execute
    sh -c "createrepo <path_to_repo>"
    

Note that RPM tools do not understand <path_to_repo> if it contains the drive specification. In this case you will have to add a kLIBC path rewriter entry that maps e.g. /drives/p to your P: drive and then baseurl will become "file:///drives/p/temp/build/RPMS" and for createrepo you will give "/drives/p/temp/build/RPMS".

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 BDB. 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.

Note: See TracWiki for help on using the wiki.