CertNote/ Commute Study Notes
Roadmap
KOEN
CLF-C02 · FoundationalCloud Practitioner - Foundational
DVA-C02 · AssociateDeveloper - Associate
SAA-C03 · AssociateSolutions Architect - Associate
SOA-C02 · AssociateCloudOps Engineer - Associate
SAP-C02 · ProfessionalSolutions Architect - Professional
DOP-C02 · ProfessionalDevOps Engineer - Professional
Linux Master 2 · 2급KAIT Linux Master - Level 2
SCS-C03 · SpecialtySecurity - Specialty
Linux Master 1 · 1급KAIT Linux Master - Level 1
  • Week 1
    • 1.Operating Systems and Linux: What the Kernel Does
    • 2.Free Software and Distributions: The Ecosystem Built by Licenses
    • 3.Installation and Booting: From the Moment You Power On
    • 4.Filesystem Structure and File Types: Everything Is a File
    • 5.Week 1 Comprehensive Review: Time to See Through the Concepts
  • Week 2
  • Week 3
  • Week 4
  • Week 5
  • Week 6
  • Week 7
    • 1.Package Management: RPM/YUM/DNF and DEB/APT, Both Families at a Glance
    • 2.Source Compilation and Libraries: What tar→configure→make→make install Really Mean
    • 3.The Kernel and Modules: Handling the Heart of the System and Its Pluggable Parts
    • 4.Device Management and Printers: Handling Hardware with /dev and udev, Printing with CUPS
    • 5.Week 7 Comprehensive Review: The Big Picture of Backup and System Administration
    • 6.Virtualization Management: Using One Server Like Many with Hypervisors, KVM, and Containers
  • Week 8
  • Week 9
  • Week 10
  • Week 11
  • Week 12
  • Week 13
  • Week 14
MLA-C01 · AssociateMachine Learning Engineer - Associate
AIF-C01 · FoundationalAI Practitioner - Foundational
DEA-C01 · AssociateData Engineer - Associate
MLS-C01 · SpecialtyMachine Learning - Specialty
SQLD · 개발자SQL Developer (SQLD)

© CertNote · 주간랩스

  • About
  • Changelog
  • Contact
  • Terms
  • Privacy
← Linux Master 1/Week 7/Day 1

Based on the Linux Master 1 exam syllabus·Report an error

Linux Master 1· AssociateWeek 7 · Day 1~23 min read

Day 1 - Package Management: RPM/YUM/DNF and DEB/APT, Both Families at a Glance

📌 Key Takeaways

  • Installing a package is not just unpacking an archive — it means recording in a database what was installed, where, and in which version. The same file unpacked with tar is not an installation, but unpacked with rpm -i it is.
  • The backbone is 2 layers × 2 families. The low-level tools (rpm, dpkg) handle only a single package file and cannot resolve dependencies automatically, while the high-level tools (yum/dnf, apt) fetch dependencies automatically from repositories.
  • Red Hat family = .rpm + rpm/yum/dnf, Debian family = .deb + dpkg/apt. The commands map 1:1 — rpm -ivh ↔ dpkg -i, yum install ↔ apt install, rpm -qa ↔ dpkg -l.
  • The 3 big exam traps: apt update is not an installation but an update of the package list (index); the direction of rpm -qf (file→package) versus rpm -ql (package→files); and the case of dpkg -l (installed list) versus -L (file list).
  • Removal splits too — dpkg -r leaves the configuration files behind, while dpkg -P (Purge) removes the configuration as well. rpm -e makes no such distinction.

RPM — The Low-Level Package Tool of the Red Hat Family

  • The Red Hat family (RHEL, CentOS, Rocky, Fedora) uses .rpm packages and the RPM/YUM/DNF tools.
  • rpm (Red Hat Package Manager) is the most basic tool for installing, removing, and querying a single .rpm file.
  • The package file name itself carries information.
# httpd-2.4.6-97.el7.x86_64.rpm
#  └name  └version └release └distro └architecture

Install, remove, and upgrade are done with a single option (-i/-U/-F/-e) + helper options (-v, -h).

rpm -ivh httpd-2.4.6-97.el7.x86_64.rpm   # install + verbose + hash progress bar
rpm -Uvh httpd-2.4.6-98.el7.x86_64.rpm   # upgrade (installs fresh if not present)
rpm -Fvh httpd-2.4.6-98.el7.x86_64.rpm   # Freshen (updates only what is already installed)
rpm -e httpd                              # erase (remove) — package name, not file name

The decisive difference between -i (install) and -U (Upgrade) is how an existing version is handled. -i stops with an "already installed" error if the package is already there, whereas -U removes the old version and replaces it with the new one. On top of that, -U installs the package fresh even if it was never installed. That is why -Uvh is the most common choice in practice. -F (Freshen) goes one step further: it updates only packages that are already installed and leaves uninstalled packages alone.

Queries start with -q. This is where people easily get confused.

rpm -qa                # list of all installed packages (all)
rpm -q httpd           # whether a specific package is installed + its version
rpm -qi httpd          # detailed information (information)
rpm -ql httpd          # list of files installed by that package (list)
rpm -qf /usr/sbin/httpd  # which package this file belongs to (file)
rpm -qc httpd          # configuration files only (config)
rpm -V httpd           # verify whether anything was altered since installation (Verify)
OptionMeaningCommon form
-iinstallrpm -ivh pkg.rpm
-UUpgrade (installs if absent)rpm -Uvh pkg.rpm
-FFreshen (installed only)rpm -Fvh pkg.rpm
-eerase (remove)rpm -e pkg
-v -hverbose + progress bar (#)used together when installing
-qafull listrpm -qa | grep ...
-qlfile list of a packagewhere was it installed?
-qftrace file→packagerpm -qf /path

rpm -qf (file→package) and rpm -ql (package→files) are queries in opposite directions. "Who installed this file?" is -qf; "What did this package install?" is -ql. An answer choice that swaps the two is wrong. Another trap: the q (query) must not be missing — rpm -f is not a valid combination.

⚠️ Trap: rpm -ivh cannot resolve dependencies automatically. If package A requires B, it stops with a "Failed dependencies: B is needed" error. You can force it to ignore this with --nodeps, but that may break the system and is not recommended. Automatic dependency resolution is exactly why YUM/DNF, covered next, exist.

# Try it yourself — rpm query practice (on a RHEL/CentOS family system)
rpm -qa | wc -l                # number of installed packages
rpm -qa | grep kernel          # kernel-related packages
rpm -qi bash                   # details of the bash package
rpm -ql coreutils | head       # files installed by coreutils
rpm -qf /bin/ls                # which package does ls belong to?

YUM / DNF — High-Level Tools That Resolve Dependencies Automatically

  • YUM (Yellowdog Updater Modified): appeared to solve rpm's dependency hell. Its successor is DNF (Dandified YUM).
  • The command set is nearly identical, so replacing yum with dnf works in most cases. From RHEL 8 on, the default is DNF, and yum is a symbolic link to dnf.
  • The key difference is that it pulls in dependencies automatically from a repository. It downloads every needed package from the repository URLs defined in /etc/yum.repos.d/*.repo and installs them all at once.
yum install httpd          # install httpd + all required dependencies automatically
yum remove httpd           # remove (taking dependencies into account)
yum update                 # update all packages
yum update httpd           # update only a specific package
yum search keyword         # search names and descriptions
yum info httpd             # package information
yum list installed         # list of installed packages
yum repolist               # list of enabled repositories
yum clean all              # clean the cache
yum groupinstall "Development Tools"   # install a package group
TaskRPM (low-level)YUM/DNF (high-level)
Installrpm -ivh pkg.rpmyum install pkg
Removerpm -e pkgyum remove pkg
Upgraderpm -Uvh pkg.rpmyum update pkg
DependenciesManual (shows errors only)Resolved automatically
Package sourceLocal .rpm fileRepository (internet)
SearchNot possible (installed only)yum search

The input differs between rpm install and yum install. rpm takes a local .rpm file path, but yum takes only a package name (yum install httpd, no file name or path). That is because yum finds and downloads it from the repository by itself. On the exam, the answer to "a command that installs from an internet repository including dependencies automatically" is always on the yum/dnf side.

yum repolist shows the currently enabled repositories. Repositories are defined in .repo files under /etc/yum.repos.d/, and each file contains entries such as [repository ID], baseurl=, enabled=1, and gpgcheck=1. With gpgcheck=1, the package's GPG signature is verified, which guards against tampering and forgery. On internal networks, people sometimes build a local mirror repository and point to it with baseurl=file:///path.

⚠️ Trap: When you remove a package with yum remove, other packages that depended on it may be removed as well. Carelessly removing a core library can paralyze the system. Always check the "Removing" list that yum shows before you remove anything. Also, don't confuse yum update (everything) with yum update package (a single package).

# Try it yourself — yum/dnf
yum repolist                   # which repositories are enabled?
yum list installed | head      # some of the installed packages
yum info bash                  # information on the bash package
yum search editor              # search packages containing 'editor'
# works the same with dnf
dnf repolist

DEB · dpkg — The Low-Level Package Tool of the Debian Family

  • Packages of the Debian family (Debian, Ubuntu, Mint) have the .deb extension.
  • The low-level tool that handles them directly is dpkg — the counterpart of rpm in the Red Hat family.
  • .deb file names carry information too.
# nginx_1.18.0-6_amd64.deb
#  └name  └version     └architecture
dpkg -i nginx_1.18.0-6_amd64.deb   # install
dpkg -r nginx                       # remove — keeps configuration files
dpkg -P nginx                       # complete removal (Purge) — removes configuration too
dpkg -l                             # list of installed packages (list)
dpkg -l nginx                       # status of a specific package
dpkg -L nginx                       # list of files installed by that package (List files)
dpkg -S /usr/sbin/nginx             # which package this file belongs to (Search)
dpkg -s nginx                       # package status and information (status)
TaskRPM commanddpkg command
Installrpm -ivh pkg.rpmdpkg -i pkg.deb
Remove (keep configuration)rpm -e pkgdpkg -r pkg
Complete removal(not applicable)dpkg -P pkg
Full listrpm -qadpkg -l
Files of a packagerpm -ql pkgdpkg -L pkg
File→packagerpm -qf filedpkg -S file

dpkg distinguishes between -r (remove) and -P (Purge). -r removes only the program files and keeps the configuration files (under /etc) — so that your settings are preserved when you reinstall later. -P (Purge) removes even the configuration files completely. RPM has no such distinction (rpm -e removes the configuration too).

Watch the letter case. dpkg -l (lowercase L) is the installed list, and dpkg -L (uppercase L) is the list of files installed by a specific package. Where rpm separates -ql from -qa, dpkg separates -L from -l by case alone. The exam includes wrong answers with this case swapped.

Like rpm -ivh, dpkg -i also cannot resolve dependencies automatically. If a dependency is missing, the package is left in an "installed but not configured" state. In that case, the standard remedy is to fill in the dependencies with apt-get install -f (fix-broken), or to use apt from the start.

APT — The High-Level Tool of the Debian Family

  • APT (Advanced Package Tool) is the high-level tool corresponding to YUM/DNF, pulling in dependencies automatically from repositories.
  • The apt command, which merges what used to be split into apt-get/apt-cache, is now the standard.
apt update                  # refresh the repository package list (not an install!)
apt upgrade                 # upgrade installed packages
apt install nginx           # install (dependencies automatic)
apt remove nginx            # remove (keeps configuration)
apt purge nginx             # complete removal (including configuration)
apt search keyword          # search
apt show nginx              # package information
apt list --installed        # installed list
apt autoremove              # clean up dependencies that are no longer needed

Don't confuse apt update with apt upgrade. apt update does not install or update any package. It only refreshes the list (index) of "which versions of which packages exist" from the repositories. The actual upgrade is done by apt upgrade. That's why you always use the order apt update && apt upgrade. YUM's yum update differs in that it does both steps at once.

TaskYUM/DNFAPT
Refresh repository list(automatic)apt update
Upgradeyum updateapt upgrade
Installyum install pkgapt install pkg
Removeyum remove pkgapt remove pkg
Searchyum searchapt search
Infoyum infoapt show

APT's repository definitions live in /etc/apt/sources.list and /etc/apt/sources.list.d/*.list, and each line has the format deb URL distribution component. apt update downloads the index (Packages.gz) from the URLs in this list and stores it in the local cache (/var/lib/apt/lists/). So if you skip update, apt looks only at the old index and wrongly concludes "no newer version".

RPM and DEB appeared almost simultaneously in the mid-1990s. Both were notorious for "dependency hell" in the early days — to install A you needed B, to install B you needed C, and the user had to download each one by hand. Debian was first to show automatic dependency resolution with APT in 1998, and the Red Hat camp caught up with yum (adopted by Fedora around 2003). The fact that the commands of the two families mirror each other like a decalcomania today is the result of each solving the same problems (dependencies, repositories, verification) on its own. If you memorize this correspondence as a table, you get half of the exam right automatically.

📖 Glossary

  • Package : A bundle that packs precompiled program files and installation information together.
  • Dependency : Another package that must be installed together for a given package to work.
  • Dependency hell : The situation where installing A needs B and B needs C, so the user has to download them one after another by hand.
  • Repository : An internet (or internal) server where packages are gathered. High-level tools fetch from here.
  • /etc/yum.repos.d : The directory where the repositories YUM/DNF will use are written as .repo files.
  • /etc/apt/sources.list : The file where the repositories APT will use are written in the format deb URL distribution component.
  • gpgcheck : A repository configuration entry. When 1, the package's GPG signature is checked to block tampered or forged packages.
  • Index (package list) : A list of which versions of which packages exist in a repository. apt update downloads it and stores it in /var/lib/apt/lists/.
  • Purge : Complete removal that deletes not just the program but also the configuration files under /etc. dpkg -P, apt purge.
  • Freshen (-F) : An rpm option that updates only already-installed packages to the new version and leaves packages that are not installed alone.

📝 Practice Questions

Click a choice to reveal the answer and explanation.

Question 1

Which command is most appropriate for installing an RPM package such that it replaces an older version of the same package if one is already installed, installs it fresh if not, and shows a progress bar?

Question 2

Which command checks which RPM package installed the file /usr/sbin/httpd?

Question 3

What is the single most important advantage of YUM/DNF compared with RPM?

Question 4

Which statement correctly describes the difference between dpkg -r and dpkg -P on the Debian family?

Question 5

Which best describes the role of the apt update command?

Question 6

Which Debian family command corresponds to the Red Hat family's rpm -qa?

Question 7

Which of the following correctly pairs high-level package tools (repository-based, automatic dependency resolution)?

PreviousWeek 6 Comprehensive Review: Tying Processes, Initialization, and Scheduling Together on One PageWeek 6 · Day 5Next Source Compilation and Libraries: What tar→configure→make→make install Really MeanWeek 7 · Day 2

Official references

  • Linux Master 1 official exam syllabus(opens in a new tab)

On this page

  • Key Takeaways
  • RPM — The Low-Level Package Tool of the Red Hat Family
  • YUM / DNF — High-Level Tools That Resolve Dependencies Automatically
  • DEB · dpkg — The Low-Level Package Tool of the Debian Family
  • APT — The High-Level Tool of the Debian Family
  • Glossary
  • Practice Questions