High-level (yum · dnf · apt) │ downloads from repositories and resolves dependencies automatically ▼ Low-level (rpm · dpkg) │ just installs or removes the one file you give it ▼ System
Item
Low-level
High-level
Handles
A single file
A repository
Dependencies
Cannot resolve them on its own
Resolves them automatically
Examples
rpm, dpkg
yum, dnf, apt
This distinction is the heart of this unit. If asked "Which tool resolves dependencies automatically?", the answer is the high-level tool (yum, apt).
rpm -ivh package.rpm # install (install, verbose, hash)rpm -Uvh package.rpm # upgrade (installs if not present)rpm -e package-name # erase (erase)rpm -qa # all installed packages (query all)rpm -q package-name # is that package installed?rpm -ql package-name # list of files the package installed (list)rpm -qi package-name # package info (info)rpm -qf /path/file # which package owns this file (file)rpm -V package-name # tamper check (verify)
Option
Meaning
-i
Install (install)
-U
Upgrade — also installs if not present
-F
Upgrade — only if already installed (freshen)
-e
Erase (erase)
-q
Query (query)
-v / -h
Verbose / show progress (#)
--nodeps
Ignore dependencies and force ahead
Difference between -i and -U — -U installs fresh if the package is absent, but -F updates only if it is already present.
rpm does not resolve dependencies. If a required package is missing, it prints an error and stops.
-v and -h only change how output is displayed, not what the command does. It is customary to combine three letters, as in -ivh and -Uvh.
Kernel packages are customarily installed with -i, not -U.-U removes the old version, so if the new kernel fails to boot, the old kernel you would fall back to is gone.
# rpm -ivh httpd-2.4.6-97.el7.x86_64.rpmerror: Failed dependencies: httpd-tools = 2.4.6-97.el7 is needed by httpd-2.4.6-97.el7.x86_64 /etc/mime.types is needed by httpd-2.4.6-97.el7.x86_64
rpmonly tells you what is missing and does not fetch it. Above, the httpd-tools package and a package that provides the /etc/mime.types file must be present first.
Removal is blocked the same way. Trying to remove something other packages rely on with rpm -e gives an is needed by (installed) … error.
Response
Command
Assessment
Install the missing package first
rpm -ivh httpd-tools-….rpm
The orthodox way, but that package may require yet another one
Leave it to the high-level tool
yum install httpd
Recommended — it pulls the needed packages from the repository too
Ignore and force ahead
rpm -ivh --nodeps file.rpm
It installs, but may not run
Force option
Meaning
--nodeps
Skips the dependency check (for both install and erase)
--force
Overwrites and installs even if the package or files are already installed
--test
Does not actually install; only checks whether there would be a problem
-ql and -qf point in opposite directions.-ql goes package → files, and -qf goes file → package. Questions put the two side by side in the choices.
-qa prints hundreds of lines, so you usually filter it with grep. With -q alone you must know the exact name, but -qa | grep finds a package from just part of the name.
# rpm -V httpdS.5....T. c /etc/httpd/conf/httpd.conf
It compares the file now against the values recorded at install time. No output means nothing has changed.
A letter in a position marks the item that differs — S size, 5 content (hash value), T modification time, M permissions, U owner, G group. A dot (.) means unchanged.
The c in the middle means the file is a config file. Admins are expected to edit config files, so the result above is not a problem. A 5 on an executable is something to suspect.
Questions ask about the name-version-release.architecture.rpm structure directly.
noarch means a package independent of CPU architecture (docs, scripts).
The version is the edition number of the program itself, and the release is how many times the distribution has repackaged that same version. If the program stays the same and only a security patch is added and reissued, only the release goes up.
Some package names contain hyphens. httpd-tools-2.4.6-97.el7.x86_64.rpm is read from the right — strip the architecture, release (97.el7), and version (2.4.6), and what remains, httpd-tools, is the name.
rpm gives instructions with options (hyphen + letter), while yum uses English words. In the choices, mixed notations such as yum -i or rpm install are wrong.
yum also ends up installing RPM packages internally. That is why things installed with yum show up in rpm -qa as they are. The two are not rivals but upper and lower layers.
Tool
Where it is used
yum
CentOS 7, RHEL 7 and earlier
dnf
Successor to YUM — Fedora, RHEL 8 and later
zypper
SUSE family
dnf has nearly the same command structure as yum. You use it as in dnf install.
A trap that appears: SUSE is in the RPM family, but its tool is zypper.
DNF stands for Dandified YUM. On RHEL 8 and later the yum command still exists, but it is really just a name that calls dnf.
zypper is used similarly — zypper install, zypper remove, zypper update.
Symptom
Cause
Check / fix
Install stops with Failed dependencies
Low-level tools cannot resolve dependencies
Install with yum install
rpm -e file.rpm says is not installed
Removal uses the package name
rpm -e httpd
rpm -q says is not installed though you definitely installed it
The name is not exact
Filter rpm -qa with grep
yum install cannot find the package
No repository holding that package exists or it is off
yum repolist, enabled in the .repo
You want to know if a config file was edited
—
rpm -V package-name
Tomorrow we cover the Debian family's dpkg and apt, and how to compile source yourself.