What are rpm packages?

  • Software on RHEL is installed using packages in Red Hat Package Manager (RPM) format
  • An RPM package contains a compressed archive, as well as package metadata
  • In the metadata, package dependencies are identified
  • To handle dependency management, RHEL uses repositories for package installation
  • If a dependency was found, it is installed automatically from the repository
  • Installed packages are registered in the RPM database
 

Querying RPM packages

  • Some commands query(rpm -q[pafl--scripts--changelog]) the RPM database
  • rpm -qa shows all packages that are currently installed
  • rpm -qf filename shows from which package filename was installed
  • rpm -ql lists files installed from a package
  • rpm -q --scripts shows scripts executed while installing the package
  • rpm -q --changelog shows the change log for a package
  • Querying package files is also possible
    • Add -p to any of the commands above

Extracting RPM packages

  • Contents of an RPM package can be extracted to the current directory (without installing).

rpm2cpio mypackage-1.0.rpm | cpio -tv
  • rpm2cpio mypackage-1.0.rpm | cpio -tv will show the contents of a package
rpm2cpio mypackage-1.0.rpm | cpio -idmv
  • rpm2cpio mypackage-1.0.rpm | cpio -idmv extracts the package contents to the current directory