Tag: Linux rpm command

  • Introduce to Linux rpm command

    RPM Package Manager (RPM) (originally Red Hat Package Manager; now a recursive acronym) is a free and open-source package management system. The name RPM refers to .rpm file format and the package manager program itself. RPM was intended primarily for Linux distributions; the file format is the baseline package format of the Linux Standard Base.

    Red Hat.Mandavi at de.wikipedia [Public domain]
    1. Install the package

    rpm -ivh ***.rpm

    2. Upgrade the package

    rpm -Uhv ***.rpm

    3. Remove package

    rpm -e package_name
    rpm -e –allmatches package_name //Remove all versions of packages matching package_name

    4. Query package

    rpm -q package_name
    rpm -qp ***. rpm //Get information about rpm packages in the current directory
    rpm -qa | less //List all installed packages
    rpm -qf /etc/sysctl.conf  //See which package a file belongs to
    rpm -qi package_name //Lists the standard details of this package installed
    rpm -qlp package_name //Lists the file contents of the rpm package
    rpm -q -scripts kernel | less //Lists the pre-install and post-install scripts that come with the installed rpm package

    5. Check installed packages

    rpm -qa

    6. Rebuild the rpm database

     rm /var/lib/rpm/__db.00*

    rpm –rebuilddb

    7. Extract files from rpm

    rpm2cpio ***.rpm | cpio -idmv