Linucate
~ Linucate_

102.5 Use RPM and YUM package management

All Levels

Introduction

This lesson is about RPM-based package management.

The main question is:

How do you manage packages on RPM-based systems such as RHEL, CentOS, Rocky, Fedora, openSUSE, and similar distributions?

What you should be able to do after this lesson:

  • Use rpm for package file operations and package queries.
  • Use yum or zypper for repo-based package management.
  • Recognize where YUM repo config lives.
  • Know that dnf exists as a modern replacement on many systems.

Two Layers: rpm and a Higher-Level Tool

rpm

Low-level package tool for .rpm files.

yum or zypper

Higher-level tools that work with repositories and dependency resolution.

Awareness point:

  • many modern systems use dnf
  • LPIC still expects you to know yum

Basic rpm Commands

Install

sudo rpm -ivh package.rpm

Upgrade

sudo rpm -Uvh package.rpm

Important beginner note:

  • direct rpm installation works on a local package file
  • repository tools are usually safer for normal admin work because they handle dependency resolution more comfortably

Remove

sudo rpm -e package-name

Query a package

rpm -q package-name

List files from a package

rpm -ql package-name

Find which package owns a file

rpm -qf /usr/bin/ssh

Representative example output:

openssh-clients-9.7p1-1.x86_64

What this shows:

  • rpm -qf tells you which installed package owns a file
  • RPM package names often include version and architecture

Show package info

rpm -qi package-name

Verify an installed package

rpm -V package-name

Check a package signature

rpm --checksig package.rpm

Integrity and Signatures

RPM can check package integrity and signatures.

The beginner idea:

  • RPM can tell you whether a package is installed
  • RPM can tell you what files it provides
  • RPM can help verify package integrity

yum Basics

Install

sudo yum install package-name

Remove

sudo yum remove package-name

Search

yum search keyword

Representative example output:

====================== Name Exactly Matched: nginx ======================
nginx.x86_64 : A high performance web server and reverse proxy server

What this shows:

  • repository tools search package metadata, not just installed files
  • the result often includes package name, architecture, and a short summary

Show info

yum info package-name

Reinstall

sudo yum reinstall package-name

zypper Basics

On SUSE-style systems, you may use:

sudo zypper install package-name
sudo zypper remove package-name
zypper search keyword
zypper info package-name

YUM Configuration

Important locations:

/etc/yum.conf
/etc/yum.repos.d/

The idea is simple:

  • yum.conf = main YUM settings
  • .repo files = repository definitions

rpm2cpio

This tool lets you extract files from an RPM package archive.

Why you should know it:

  • sometimes you want to inspect package contents without installing it

Integrity, Status, and Signatures

For LPIC, RPM is not only about install and remove.

You should also be comfortable with questions such as:

  • Is the package installed?
  • What version and release is it?
  • Which files belong to it?
  • Does the package verify correctly?
  • Is the package signature valid?

Legacy / Exam Note

In real life, many RPM-based systems now use dnf. LPIC-1 still expects you to recognize older and broader tool naming:

  • rpm
  • yum
  • zypper
  • dnf as the modern successor on many systems

This is one of those places where exam coverage is wider than one distro's current default habit.

Practice Step by Step

1) Find which package owns a file
  1. Run: rpm -qf /usr/bin/ssh
  2. Read the package name.
2) Search a repository before installing
  1. Search: yum search nginx
  2. Inspect: yum info nginx
  3. If you are on a test system and really want to install it: sudo yum install nginx
3) Do the same thing on a zypper-based system
  1. Search: zypper search nginx
  2. Inspect: zypper info nginx
  3. If you are on a test system and really want to install it: sudo zypper install nginx

Cheat Sheet

  • rpm -ivh = install RPM file
  • rpm -Uvh = upgrade RPM file
  • rpm -e = remove package
  • rpm -q = query package
  • rpm -ql = list files from a package
  • rpm -qf <file> = find package owning a file
  • rpm -qi = show package info
  • yum install/remove/search/info = repo-based RPM management
  • zypper install/remove/search/info = SUSE-style repo management
  • /etc/yum.conf = YUM main config
  • /etc/yum.repos.d/ = repo definitions
  • dnf = modern YUM successor on many systems
  • rpm2cpio = extract files from an RPM archive
🎯

Test Your Knowledge

Complete the quiz to assess your understanding of this course's concepts.