Linux course index · Linux Intermediate category · Lesson 5 of 9
AI disclosure — AI-generated content, posted as is. AI can make mistakes. This lesson draws on the linked Open Education posts and adds original explanations or lab examples where useful. The newly written explanations and examples may be freely reused. Linked source material retains its own terms.
Learning goal
Inspect installed packages and repositories before taking action, and tell a package database from a dependency resolver.
Concepts and setup
On Debian and Ubuntu, dpkg tracks installed packages and apt resolves dependencies from repositories. On Red Hat-family systems, rpm is the low-level package tool and dnf manages repositories and dependencies. Older posts use yum and describe historical behavior. Follow the installed release’s documentation rather than assuming their commands behave identically.
A repository is not just a folder of packages. The package manager reads repository metadata and verifies signatures according to its trust policy. The archive’s FTP-based repository demonstration is historical. Use approved repositories and do not bypass verification to make a lab work.
Check software provenance on Ubuntu or Debian
dpkg-query -W -f='${Package} ${Version}\n' bash
apt-cache policy bash
apt-get -s install bash
Possible output
bash 5.2.21-2ubuntu4
bash:
Installed: 5.2.21-2ubuntu4
Candidate: 5.2.21-2ubuntu4
0 upgraded, 0 newly installed, 0 to remove ...
In the first command write the format exactly as displayed. The simulation plans changes but does not install packages. An available upgrade would produce a different plan. Mark the distribution, versions, and approved origin in your notes.
Inspect a Red Hat-family lab instead
rpm -q bash
dnf repolist
dnf info bash
Possible output
bash-5.1.8-EXAMPLE.x86_64
repo id repo name
baseos BaseOS
appstream AppStream
Installed Packages
Name : bash
EXAMPLE is a placeholder, not a release number. Repository IDs vary. dnf may refresh cache metadata. Nothing in this walkthrough installs or removes a package.
Questions only
Quick-check questions
- Does rpm -q bash search the internet for updates?
- Why does repository trust matter even when a package name looks right?
Assessment questions
- Before upgrading bash, which Ubuntu command previews where a candidate comes from?
- Your Red Hat-family system does not list an expected repository. Which nonmutating checks come first?
- Why prefer a dependency resolver to installing individual local packages with rpm?
Questions and answers
Quick-check answers
- Does rpm -q bash search the internet for updates?
Answer — No. It queries the local RPM database. - Why does repository trust matter even when a package name looks right?
Answer — Anyone can name a package bash. Trusted signatures and repository policy help establish provenance.
Assessment answer key
- Before upgrading bash, which Ubuntu command previews where a candidate comes from?
Answer — apt-cache policy bash shows installed and candidate versions plus origins. apt-get -s install bash previews a transaction. - Your Red Hat-family system does not list an expected repository. Which nonmutating checks come first?
Answer — Start with dnf repolist and compare expected repository IDs and enabled states with the distribution’s configured sources. Do not disable signature checks. - Why prefer a dependency resolver to installing individual local packages with rpm?
Answer — A resolver can evaluate required packages, compatible versions, and the wider transaction.
Source articles on this site
- yum upgrade and yum update
- Check if your yum server is working or not
- Create your own yum repo in Centos/Redhat #DevOps #RHCSA
- How to create a RPM package in Linux #26 #RHCSA
- Some Ubuntu Linux Commands used in AWS platform #Unix/Linux #RHCSA
Continue the course
Previous lesson 04 — Bash Conditions, Loops, Functions, and Debugging. Next lesson 06 — Boot, Services, Logs, and Timers.
Linux course index · Linux Intermediate category · Lesson 5 of 9
