Linux RPMs – All you need to know

This document contains an overview of the principal RPM commands for installing, uninstalling, upgrading, querying, listing, and checking RPM packages on your Red Hat Linux system.
This document uses apache rpm httpd-2.0.49-4.i386.rpm , as an example.

  1. About RPM naming conventions
  2. All rpms follow the similar naming conventions

    package name version release architecture Package Type
    httpd 2.0.49 4 i386 rpm

    name is a name describing the packaged software.
    version is the version of the packaged software.
    release is the number of times this version of the software has been packaged.
    architecture is the type of computer hardware rpm is meant to run on for example i3836,alpha ,Sparc,mips,ppc,SGI,m68k ) .

    It may also be the string
    noarch – no artitecture – indicating package is not hardware specific..
    nosrc – no source – means it has only package building files and
    src – Source – means it contains the package building files and the software’s source code.

  3. Installing RPMs
  4. For RPMs present locally

    # rpm -ivh httpd-2.0.49-4.i386.rpm

    -i Install
    -v Verbose
    -h Print 50 hash marks as the package archive is unpacked.

    For RPMs present on remote ftp location
    # rpm -i ftp:////httpd-2.0.49-4.i386.rpm

    For RPMs present on remote http location
    # rpm -i http:////httpd-2.0.49-4.i386.rpm

  5. Upgrading existing RPMs
  6. # rpm -Uvh httpd-2.0.52-12.i386.rpm

    # rpm -Uvh ftp:////httpd-2.0.52-12.i386.rpm
    # rpm -Uvh http:////httpd-2.0.52-12.i386.rpm

    Notes:
    – Upgrade uninstalls the old package and installs the new one
    – If installing kernel use the install option as that will install new kernal as a new package and you can use old version if new does not work. Upgrade will remove the old version and you can’t go back .

  7. Removing RPMs

  8. # rpm -e httpd

    This is the simplest way of removing a package. only package name is needed. Package is simply deleted and no information is displayed.

    To see what is going on, use the following

    #rpm -evv httpd

  9. Lising installed packages
  10. All packages installed on the system

    # rpm -qa

    q – query
    a – all

    Single Package – installed in the system

    # rpm -q httpd

    httpd-2.0.52-12

  11. Finding Package information
  12. # rpm -qi httpd

    gives following information about httpd package

    Name : httpd Relocations: (not relocatable)
    Version : 2.0.52 Vendor: (none)
    Release : 0 Build Date: Thu 13 Mar 2008 05:11:13 AM PDT
    Install Date: Fri 08 May 2010 08:18:45 PM PDT Build Host: mybuildhost.domain.com
    Group : System Environment/Daemons Source RPM: httpd-2.0.52-12.src.rpm
    Size : 7982208 License: Distributable
    Signature : (none)
    Packager : sysadmins group
    Summary : The httpd Web server
    Description :

  13. Lising files in an installed packages
  14. # rpm -ql httpd

  15. Finding the association of a file to RPM
  16. # rpm -qf /usr/local/httpd/bin

    httpd-2.0.52

  17. List files in RPM package from local or remote destination .

  18. # rpm -qpl httpd-2.0.52-12.i386.rpm
    # rpm -qpl ftp:////httpd-2.0.52-12.i386.rpm
    # rpm -qpl http:////httpd-2.0.52-12.i386.rpm

  19. verify an installed package
  20. # rpm –verify httpd
    To verify an installed package. This command will list all files that do NOT pass the verify tests (done on size, MD5 signature, etc). Where a file does NOT pass, the output is listed using the following codes that signify what failed:
    S File size
    M Mode (includes permissions and file type)
    5 MD5 sum
    L Symlink
    D Device
    U User
    G Group
    T Mtime
    Take for example the following:
    # rpm –verify mysql
    S.5….T c /etc/my.cnf
    This example indicates that file /etc/my.cnf failed on:
    File size
    MD5 Sum
    Modified Time
    However, the “c” tells us this is a configuration file so that explains the changes. It should still be looked at to determine what the changes

Leave a Reply

Your email address will not be published. Required fields are marked *