Introduction
An .rpm file is a software package for Fedora, Red Hat Enterprise Linux,
openSUSE and the other Linux distributions that use the
RPM Package Manager, first made by Red Hat. It holds the
files to install, the package’s name, version and the other packages it needs, and
scripts to run when it is installed or removed. The rpm tool installs a
single file; DNF and zypper fetch packages and their dependencies from
repositories.
Source packages, which hold the source code and the spec file used to build the
binary packages, end in .src.rpm.
Structure
An RPM file has four parts. The lead is a fixed 96-byte block from the format’s early
days, starting with the magic bytes ED AB EE DB; tools now mostly ignore
it. Then come two headers in the same structure, each starting with
8E AD E8 01: the signature header, holding checksums and signatures of the
rest of the file, and the main header, a table of tagged entries giving the name,
version, dependencies, scripts and file list. The payload follows: a
cpio archive of the files, compressed with gzip, xz or zstd.
0lead, magicED AB EE DB96 bytes96signature header: checksums and signatures, padded to 8 bytesvaries…header: name, version, dependencies, scripts, file listvaries…payload: a compressed cpio archive of the filesvaries