20 RPM Commands in Linux

RPM (Red Hat Package Manager) is an default open source and most popular package management utility for Red Hat based systems like (RHEL, CentOS and Fedora). The tool allows system administrators and users to install, update, uninstall, query, verify and manage system software packages in Unix/Linux operating systems

  1. Some Facts about RPM (RedHat Package Manager)

    • RPM is free and released under GPL (General Public License).
    • RPM keeps the information of all the installed packages under /var/lib/rpm database.
    • RPM is the only way to install packages under Linux systems, if you've installed packages using source code, then rpm won't manage it.
    • RPM deals with .rpm files, which contains the actual information about the packages such as: what it is, from where it comes, dependencies info, version info etc.

  2. There are five basic modes for RPM command

    • Install: It is used to install any RPM package.
    • Remove: It is used to erase, remove or un-install any RPM package.
    • Upgrade: It is used to update the existing RPM package.
    • Verify: It is used to query about different RPM packages.
    • Query: It is used for the verification of any RPM package.

  3. Where to find RPM packages

  4. 20 RPM Commands

    # 1. How to Check an RPM Signature Package
    # Always check the PGP signature of packages before installing them on your Linux systems
    # and make sure its integrity and origin is OK
    rpm --checksig pidgin-2.7.9-5.el6.2.i686.rpm
    # 2. How to Install an RPM Package
    # Installing an rpm software package, use the following command with -i option
    # -i: install a package
    # -v: verbose for a nicer display
    # -h: print hash marks as the package archive is unpacked
    rpm -ivh pidgin-2.7.9-5.el6.2.i686.rpm
    # 3. How to check dependencies of RPM Package before Installing
    # Do a dependency check before installing or upgrading a package
    # -q: Query a package
    # -p: List capabilities this package provides.
    # -R: List capabilities on which this package depends
    rpm -qpR BitTorrent-5.2.2-1-Python2.4.noarch.rpm
    # 4. How to Install a RPM Package Without Dependencies
    # Ignore those dependencies by using the option --nodeps (no dependencies check) before installing the package
    rpm -ivh --nodeps BitTorrent-5.2.2-1-Python2.4.noarch.rpm
    # 5. How to check an Installed RPM Package
    # Using -q option with package name, will show whether an rpm installed or not
    rpm -q BitTorrent
    # 6. How to List all files of an installed RPM package
    # View all the files of an installed rpm packages, use the -ql (query list) with rpm command
    rpm -ql BitTorrent
    # 7. How to List Recently Installed RPM Packages
    # Use the following rpm command with -qa (query all) option, will list all the recently installed rpm packages
    rpm -qa --last
    # 8. How to List All Installed RPM Packages
    # Print the all the names of installed packages on your Linux system
    rpm -qa
    # 9. How to Upgrade a RPM Package
    # Upgrade any RPM package '-U' (upgrade) option will be used
    rpm -Uvh nx-3.5.0-2.el6.centos.i686.rpm
    # 10. How to Remove a RPM Package
    # Uninstall an RPM package
    rpm -evv nx
    # 11. How to Remove an RPM Package Without Dependencies
    # The --nodeps (Do not check dependencies) option forcefully remove the rpm package from the system
    # But keep in mind removing particular package may break other working applications
    rpm -ev --nodeps vsftpd
    # 12. How to Query a file that belongs which RPM Package
    # List of files and you would like to find out which package belongs to these files
    rpm -qf /usr/bin/htpasswd
    # 13. How to Query a Information of Installed RPM Package
    # Know the information about the installed package
    rpm -qi vsftpd
    # 14. Get the Information of RPM Package Before Installing
    # Know the information of a package before installing
    rpm -qip sqlbuddy-1.3.3-1.noarch.rpm
    # 15. How to Query documentation of Installed RPM Package
    # List of available documentation of an installed package
    rpm -qdf /usr/bin/vmstat
    # 16. How to Verify a RPM Package
    # Verifying a package compares information of installed files of the package against the rpm database
    rpm -Vp sqlbuddy-1.3.3-1.noarch.rpm
    # 17. How to Verify all RPM Packages
    # Type the following command to verify all the installed rpm packages
    rpm -Va
    # 18. How to Import an RPM GPG key
    # Verify RHEL/CentOS/Fedora packages, you must import the GPG key
    rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
    # 19. How to List all Imported RPM GPG keys
    # Print all the imported GPG keys in your system, use the following command
    rpm -qa gpg-pubkey*
    # 20. How To rebuild Corrupted RPM Database
    # Sometimes rpm database gets corrupted and stops all the functionality of rpm and other applications on the system. So, at the time we need to rebuild the rpm database and restore it
    cd /var/lib
    rm __db*
    rpm --rebuilddb
    rpmdb_verify Packages
    

Comments

Popular posts from this blog

Reduce TIME_WAIT Socket Connections