A Linux User Reference

Search tips
  • search ignores words that are less than 4 characters in length
  • searches are case insensitve
  • if a search does not return anything try it in Boolean mode then Query expansion mode by checking the appropriate radio button e.g. searching for 'cron' in just the Administration category returns nothing - presumably because the 50% threshold is reached. Boolean mode ignores this threshold so a search for 'cron' returns several hits
  • in Boolean mode preceding a word with a '+' means the result must include that word, a '-' means it must not
  • in Boolean mode '+crontab -anacron' means match articles about crontab that DO NOT mention anacron
  • to match a phrase e.g. 'manage system' check the Boolean mode radio button and enclose the phrase in quotes "some phrase ..."
  • in Query expansion mode the search context is expanded beyond the keywords you entered - relevancy of hits may well be degraded


RedHat Packages

  • RedHat package manager

    A package


    A package name consists of multiple words separated by '-'. There are four common elements to a package name.

    Format varies, in general major.minor.patchlevel
    Release number, a newer same version package will have a greater revision number.
    If package contains pre-compiled files then this identifies the platform the package is designed for.

    The Redhat Package Management (RPM)

    Is a utility that maintains a DB of all installed packages and their files. Each package contains program files, config files, documentation and dependency information.

    RPM provides install, removal, upgrade, verification and other management functionality. It's general format is:

    rpm <mode> [mode options] [target]
  • Install an RPM package
    Install mode
    # rpm -i package.rpm
    # rpm --install package.rpm
    # rpm -iv --percent package.rpm   (prints % when unpacking)
    # rpm -ivh package.rpm            (prints # when unpacking)
  • Upgrade an RPM package
    Upgrade mode

    Remove old package, install new

    # rpm -U package.rpm

    Perform a Downgrade

    # rpm -U --oldpackage package.rpm

    Upgrade a file from a remote ftp server

    # rpm -Uvh ftp://user:pass@ftpsrv/dir/package.rpm
  • Delete an RPM package
    Erase mode

    Completely remove package

    # rpm -e package

    Will not remove package if there are dependencies.

  • Query an RPM package
    Query mode

    List packages that depend on package

    # rpm -q whatrequires package

    Lists packages that depend on package

    # rpm -qR package

    List all installed packages

    # rpm -qa

    Get information about this package

    # rpm -qpi vnc-server-4.0-0.beta4.3.2.i386.rpm

    Get information on package containing file

    # rpm -qfi /sbin/lsmod

    Which package contains file

    # rpm -qf /sbin/lsmod

    List all files in this package

    # rpm -ql wpasupplicant

    List all files in this package file

    # rpm -qpl vnc-server-4.0-0.beta4.3.2.i386.rpm

    List package files via ftp proxy

    # rpm -qpl --ftpproxy pxsv --ftpport pt ftp://ftpsrv/dir/pck.rpm

    Query package requisites via http proxy

    # rpm -qpR --httpproxy pxsv --httpport pt http://srv/dir/pck.rpm
  • Verify an RPM package
    Verify mode

    Can be done either pre- or post- installation.

    Verify all installed packages

    # rpm -Va

    Verify package containing this file

    # rpm -Vfi /sbin/lsmod

    Display current macro configuration in 'rpmrc'

    # rpm --showrc display

    Only report changed files in installed package

    # rpm -V xterm-227-1.fc7
    prelink: /usr/bin/xterm: at least one of file's dependencies has changed since prelinking
    s.?.....   /usr/bin/xterm

    Report on all files in installed package

    # rpm -Vv xterm-227-1.fc7
    ........   /usr/bin/resize
    ........   /usr/bin/uxterm
    prelink:   /usr/bin/xterm: at least one of file's dependencies has changed since prelinking
    s.?.....   /usr/bin/xterm
    s.5....T c /etc/ldap.conf
    .......T d /usr/share/man/man1/sqlite3.1.gz
    sM5....T c /etc/sysconfig/iptables-config

    Each file is preceded by an 8 character string (code) and a possible attribute marker.

    Code Description
    . File is unchanged since installation
    S File Size differs
    M Mode differs (includes permissions and file type)
    5 MD5 sum differs
    D Device major/minor number mismatch
    L readLink path mismatch
    U User ownership differs
    G Group ownership differs
    T mTime differs
    ? unknown/unexpected
    Attribute markers Description
    c %config configuration file.
    d %doc documentation file.
    g %ghost file (i.e. the file contents are not included in the package payload).
    l %license license file.
    r %readme readme file.
  • Check package signature before installing
    # rpm --checksig /home/mark/tars/sparse-0.4-2.fc7.x86_64.rpm
    /home/mark/tars/sparse-0.4-2.fc7.x86_64.rpm: (sha1) dsa sha1 md5 gpg OK
  • Rebuild RPM DB

    In the event that rpm commands freeze, unexpected results ...

    Remove existing DB files

    # rm -f /var/lib/rpm/__*

    Rebuild DB using extra verbosity

    # rpm -vv --rebuilddb
  • Package management tool

    A tool for installing, updating, and removing packages and their dependencies on RPM-based systems. Additional functionality is available through add-ons/plugins. Two such add-ons are yumex, a GUI front-end and yum-utils.

    Key files


    Yum's default configuration file is '/etc/yum.conf'. Additional configuration files are also read from the directories set by the 'reposdir' option (default is '/etc/yum.repos.d' and '/etc/yum/repos.d').

  • Sample configuration file
    [main]                                          # section must exist for yum to do 
                                                    # anything. Options set here are global
    reposdir=/etc/yum.repos.d,/etc/yum/repos.d      # default, only required if different
    debuglevel=2                                    # practical range is 0-10. Default=2
    errorlevel=2                                    # practical range is 0-10. Default=2
    #gpgcheck=0                                     # 1=perform signature check, 0=don't
    #exclude=package1,package2 ...                  # comma separated list of packages 
    [fedora-stable-9]                               # repository-id, a one word unique name
    name=Fedora Project Stable RPMS for RHL 9
    #gpgkey=<url>                                   # URL to repository GPG key file
    #enabled=1                                      # 1=yes, 0=no i.e. do not download
    #exclude=package1,package2 ...                  # comma separated list of packages 
    name=Fedora Project update RPMS for RHL 9
    # See man page for all options.  Variables can be used in several
    # config file options including name, baseurl and commands.
    # $releasever       Replaced with version of the package listed in distroverpkg
    # $arch             Replaced with your architecture as listed by os.uname()[4] in Python
    # $basearch         Replaced with your base architecture as listed in in yum
                        e.g. if $arch is i686 $basearch will be i386
    # $YUM0 - $YUM9     Replaced with the value of the shell environment variable of the 
                        same name.  If no shell environment variable then no replacement.
  • Some yum examples

    Install add-ons

    $ sudo yum install yumex
    $ sudo yum install yum-utils

    Install a package or packages

    yum install package1 [package2 package3 ...]

    Checks to see if a package is already installed and is the latest version. If not, downloads the package and its dependency packages (saves them in its cache directory) and installs them.

    Update one or more packages

    yum update [package1 package2 ...]

    Without arguments, each installed package is compared to packages available on listed repositories. If a newer package is available, it downloads and updates the old one. If a list of packages is given, only checks for updates of those packages.

    Remove a package or packages

    yum remove package1 [package2 package3 ...]

    Checks to see if removing the package is ok - does not break anything. Offers to remove the package and all the packages that depend on it. Generally refuses to leave any packages 'partially installed' (missing dependencies).

    List packages in repositories

    yum list [all,available,installed,updates,extras] [package list]
    # yum list all

    Without any arguments - lists all packages available to be installed on all repositories.

    Run with a list of packages (can contain file wildcard globs) - it shows both the installed packages and the available packages that match the expanded list.

    The installed, available, and update options show only installed packages, available packages or packages that will be updated by the next yum update command.

    Note: When run interactively from a shell, wildcard characters need to be escaped from the shell.

    List all installed packages

    # rpm -qa
    # yum list installed

    Find out if httpd package installed or not

    # rpm -qa | grep httpd*
    # yum list installed httpd

    Get information on one or more packages

    yum info [all,available,installed,updates,extras] [package list]

    Prints the description and summary from all matching packages. The extras option lists all packages that are installed but not available in the repositories e.g. packages that may have installed by hand.

    Search for a package

    yum search keyword

    Searches for packages matching the keyword string in the description, summary, packager and package name fields. The keyword string can contain wildcard file globs. Be sure to escape these from the shell. What package provides this file/feature

    yum whatprovides [feature|file]

    Find package(s) that provide some feature or file. Accepts file wildcard globs.

    Clean up the cache

    # yum clean

    'clean' takes various options: see the man page for details.

    Manage a group of software packages

    yum group[list,install,update]
    # yum grouplist
    Installed Groups:
       Engineering and Scientific
       MySQL Database

    Perform list, install and update functions on package groups defined for a system. Can install an entire block of software all at once - if the package group is defined on the systems.

    Install all Editors group packages

    # yum groupinstall "Editors"
  • RPM download utility

    A program for downloading RPMs from Yum repositories. Uses YUM libraries for retrieving all the information so it relies on YUM configuration for its default values e.g. which repositories to use.

    Command usage

    yumdownloader [options] package1 [package2...]

    Download the kernel RPM to /var/tmp

    # yumdownloader --destdir /var/tmp kernel

    List the URL for the kernel and kernel-smp RPMs

    # yumdownloader --urls kernel kernel-smp

    (Fedora) If 'yum' or 'up2date' complain about "bad GPG key", import the correct ones

    # rpm --import /usr/share/doc/fedora-release-*/*GPG-KEY*
    # rpm --import
    # rpm --import
  • RPM cpio archive extractor

    Extract cpio archive from RPM Package Manager (RPM) package.

    Extract/convert specified file to a cpio archive

    # rpm2cpio rpm-1.1-1.i386.rpm
    # rpm2cpio - 

    When a '-' argument is given, an rpm stream is read from stdin.

  • Maintaining yum

    Does not require any routine maintenance. To optimise speed disable repositories that are not used by either deleting it's file in /etc/yum.repos.d/ or it's repository-id section from /etc/yum.conf or using 'enabled=0' option.

    Clear files from the yum caches in order to recover disk space.

  • RPM configuration file

    The RPM configuration file, does more work than a control file does. All the details of steps needed for pre-installation, post-installation, pre-removal, and installation itself are contained as embedded script files in a .spec configuration. The spec format comes with macros for common actions.

    Create an RPM package

    % rpm -ba foo-util-1.3.spec

    Performs all build steps, does not rely on specific named directories as with DEB, but rather on directives in the more complex spec file.