Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
Wat het doet rpm works with single package files and the RPM database (/var/lib/rpm). It does not solve dependencies or use repositories — that is the job of dnf . Use dnf to install; use rpm to ask questions.
Query mode is -q: add select options (-a all, -f file, -p package file) and query options (-i info, -l files, -c configs, -d docs, --scripts). -V verifies installed files against the database — a simple integrity check.
Zo schrijf je het rpm -q [SELECT-OPTION] [QUERY-OPTION] [PACKAGE...]
rpm -V [SELECT-OPTION] [VERIFY-OPTION] [PACKAGE...]
rpm -i|-U|-F [INSTALL-OPTION] PACKAGE_FILE...
rpm -e [OPTION] PACKAGE...
rpm --import KEYFILE | -K PACKAGE_FILE Meest gebruikt
Modes -q, --queryQuery packages. -V, --verifyCompare installed files with the database. -i, --installInstall a package file (no dependency solving). -U, --upgradeInstall or upgrade a package file. -F, --freshenUpgrade only if an older version is installed. --reinstallInstall the same version again. -e, --eraseRemove a package. --import KEYFILEImport a GPG public key. -K, --checksigCheck the digests and signature of a package file. --showrcShow the rpm settings and macros. --restoreRestore owner, group and mode of files from the database. --rebuilddbRebuild the database. Select packages -a, --allAll installed packages. -f, --file FILEThe package that owns this file. -p, --package PACKAGE_FILEQuery a package file, not the database. -g, --group GROUPPackages in this RPM group. --whatprovides CAPABILITYPackages that provide it. --whatrequires CAPABILITYPackages that need it. --whatrecommends, --whatsuggests, --whatsupplements, --whatenhances, --whatobsoletes, --whatconflicts CAPABILITYPackages with this weak dependency or relation. --triggeredby PACKAGEPackages with triggers on it. --path PATHPackages that own the path (also not installed files). --hdrid SHA1, --pkgid MD5, --tid TID, --querybynumber NUMSelect by internal IDs. Query information -i, --infoPackage information (name, version, vendor, summary …). -c, --configfilesOnly config files. -d, --docfilesOnly documentation files. -s, --stateState of each file (normal, replaced …). -R, --requiresWhat the package needs. --providesWhat the package provides. --conflicts, --obsoletes, --recommends, --suggests, --supplements, --enhancesOther dependency data. --scriptsThe install and remove scripts. --triggers, --triggerscripts, --filetriggersTrigger scripts. --changelogThe change log (fixed CVEs are listed here). --changesThe change log with full dates. --lastSort by install time, newest first. --dumpDetailed file data. --filesbypkgFiles with the package name. --filecapsFile capabilities. --noghost, --noconfig, --noartifactLeave out these file types. --dupesPackages installed more than once. Verify options --nofiles, --nodeps, --noscripts, --nodigest, --nosignatureSkip these checks. --nosize, --nouser, --nogroup, --nomtime, --nomode, --nordev, --nocaps, --nolinkto, --nofiledigestSkip these file checks. Install and remove options -h, --hashShow # signs as progress. -v, --verboseMore output. --testOnly test; change nothing. --nodepsDo not check dependencies (dangerous). --forceSame as --replacepkgs --replacefiles --oldpackage. --replacepkgs, --replacefiles, --oldpackageAllow reinstall, overwrite files, downgrade. --noscripts, --notriggersDo not run scripts or triggers. --excludedocs, --includedocsWithout or with documentation. --justdbChange only the database, not the files. --nosignature, --nodigestDo not check signature or digest. --allmatchesRemove all packages with this name. --prefix NEWPATH, --relocate OLD=NEWInstall a relocatable package in another place. --ignorearch, --ignoreos, --ignoresize, --noorder, --noplugins, --nocaps, --noverify, --badreloc, --excludepath, --percent, --allfiles, --nodbSpecial install settings. General --root DIRUse another root folder. --dbpath DIRUse another database folder. --versionShow the version. Niets past bij dit filter.
$ als gewone gebruiker# als root (of met sudo)
1 Is a package installed? Kopieer $ rpm -q openssh-server
openssh-server-9.9p1-7.el10.x86_64 "package … is not installed" if not.
2 Which package owns a file? Kopieer $ rpm -qf /etc/ssh/sshd_config
openssh-server-9.9p1-7.el10.x86_64 Find the package of a config before you change it.
3 Config and doc files of a package Kopieer $ rpm -qc httpd
$ rpm -qd httpdWhere to look for settings and documentation.
4 Search the list of installed packages Kopieer $ rpm -qa | grep -i kernelAll installed kernels.
5 Newest installed packages first Kopieer $ rpm -qa --last | head What changed recently? Useful after a problem appears.
6 Check a downloaded package before installing Kopieer $ rpm -qpi tool-1.2-1.el10.x86_64.rpm
$ rpm -qp --scripts tool-1.2-1.el10.x86_64.rpmRead the scripts: they run as root.
7 Check the signature of a package file Kopieer $ rpm -K tool-1.2-1.el10.x86_64.rpm
tool-1.2-1.el10.x86_64.rpm: digests signatures OK "NOT OK" or "key ID … not found" = do not install.
8 Find changed system files (integrity) Kopieer # rpm -Va 2>/dev/null | grep -v ' c '
S.5....T. /usr/bin/someprog S = size, 5 = checksum, T = time changed. A changed binary can be malware; c = config file (often normal).
9 Is a CVE fixed? Kopieer $ rpm -q --changelog openssl | grep CVE-2024-Red Hat backports fixes; the version number alone does not tell.
10 Show imported GPG keys Kopieer $ rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE}\t%{SUMMARY}\n'Every key you trust for packages.
11 Own report format Kopieer $ rpm -qa --qf '%{NAME}\t%{VERSION}-%{RELEASE}\t%{INSTALLTIME:date}\n' | sort | head Inventory for audits.
12 Restore permissions of package files Kopieer # rpm --restore openssh-serverFixes owners and modes changed by mistake.
13 Extract files from a package without installing Kopieer $ rpm2cpio tool-1.2-1.el10.x86_64.rpm | cpio -idmv Look at files of a package safely.
Niets past bij dit filter.
Bestanden
/var/lib/rpm/The RPM database.
/etc/pki/rpm-gpg/Red Hat GPG keys. Exitcodes 0 :: Done (for -q: all packages found). 1 :: Error, or packages not installed / verify found problems.