Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

Hoofdstuk 12Naam in de cursus: Installing and Updating Software with RPM

Install and update software with RPM and DNF

Software on RHEL comes in RPM packages from repositories. DNF finds the package, pulls in everything it needs, checks the signature and installs it. rpm looks inside packages and the package database. This chapter shows the daily DNF work, the repositories, and how to answer "which package owns this file?".

  • 8 Lessen
  • 8 Commando's
  • 1 Labs

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

$ als gewone gebruiker# als root (of met sudo)

Vaardigheden in dit hoofdstuk

  • Pakketten installeren, bijwerken en verwijderen met DNF en RPM

12.1

Understand packages and repositories

An RPM package is one file with the program, its config files, its docs and scripts — plus metadata: name, version, dependencies, signature.

httpd-2.4.63-1.el10.x86_64.rpm
│     │      │ │    └── architecture (x86_64, aarch64, noarch)
│     │      │ └─────── built for Enterprise Linux 10
│     │      └───────── release (the Red Hat build number)
│     └──────────────── version of the software
└────────────────────── name

A repository is a web folder (or a local folder) full of packages plus an index. A registered RHEL 10 system gets two main repositories:

RepositoryWhat is in it
BaseOSThe core of the system: kernel, shell, basic tools, systemd
AppStreamApplications, languages and databases: Apache, PHP, Python, PostgreSQL …
dnf repolist
dnf repolist --all
ls /etc/yum.repos.d/
redhat.repo

Notitie

redhat.repo is written by subscription-manager. Do not edit it by hand: use subscription-manager repos --enable=REPO instead.

12.2

Find a package

Search by name or description, look at the details, or ask which package gives a file or command.

dnf search nginx
dnf search all "web server"
dnf info httpd
dnf list httpd
dnf list --available 'php*'
dnf provides /usr/sbin/semanage
dnf provides '*/bin/dig'
policycoreutils-python-utils-3.8-1.el10.noarch : SELinux policy core python utilities
bind-utils-32:9.18.33-1.el10.x86_64 : Utilities for querying DNS name servers

Examentip

A command is missing? dnf provides '*/bin/NAME' tells you which package to install.

Commando's in deze les

12.3

Install, update and remove

dnf install installs a package and its dependencies. dnf update updates. dnf remove removes.

dnf install httpd
dnf install -y httpd mod_ssl
dnf install ./mytool-1.2-1.el10.x86_64.rpm
dnf reinstall openssh-server
dnf check-update
dnf update
dnf update openssl
dnf update --security
dnf remove httpd
dnf autoremove
CommandWhat it does
dnf install PKGInstall (asks first; -y answers yes)
dnf install ./FILE.rpmInstall a local package file — DNF still gets its dependencies
dnf check-updateShow updates without installing them
dnf updateUpdate all packages (dnf upgrade is the same)
dnf update --securityOnly security updates
dnf remove PKGRemove a package and the packages that need it
dnf autoremoveRemove dependencies that nothing needs any more

Op het werk

A new kernel works only after a reboot. dnf needs-restarting -r tells you if the server must be rebooted after the updates.

Commando's in deze les

12.4

Install package groups

A group installs a set of packages for one job, for example a desktop or development tools.

dnf group list
dnf group list --hidden
dnf group info "Development Tools"
dnf group install "Development Tools"
dnf group install --with-optional "System Tools"
dnf group remove "Development Tools"

Commando's in deze les

12.5

Read the history and undo

DNF writes every transaction in a history. You can see what changed, and undo a transaction.

dnf history
ID     | Command line             | Date and time    | Action(s)      | Altered
----------------------------------------------------------------------------
    14 | install httpd mod_ssl    | 2026-10-27 11:20 | Install        |    9
    13 | update                   | 2026-10-26 22:01 | Upgrade        |   41
dnf history info 14
dnf history undo 14
tail /var/log/dnf.rpm.log

Onthoud

dnf history undo ID reverts one transaction. It is the fastest fix when an install broke something.

12.6

Add your own repository

A repository is defined by a small .repo file in /etc/yum.repos.d/.

/etc/yum.repos.d/local.repo
[local-appstream]
name=Local AppStream mirror
baseurl=http://repo.example.com/rhel10/AppStream/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
dnf config-manager --add-repo http://repo.example.com/rhel10/BaseOS/
dnf repolist
dnf --disablerepo='*' --enablerepo=local-appstream list --available
dnf config-manager --set-disabled local-appstream

Let op

gpgcheck=0 turns off the signature check. Then DNF installs any package from that server, also a changed one. Use it only for a local test repository you built yourself. More: Make a repository file.

Commando's in deze les

12.7

Query packages with rpm

rpm -q asks the installed package database. It is fast and works offline.

rpm -q openssh-server
openssh-server-9.9p1-7.el10.x86_64
rpm -qa | wc -l
512
rpm -qa 'kernel*'
rpm -qi httpd
rpm -ql httpd | head
rpm -qc openssh-server
/etc/ssh/sshd_config
/etc/sysconfig/sshd
rpm -qd chrony
rpm -qf /etc/ssh/sshd_config
openssh-server-9.9p1-7.el10.x86_64
rpm -q --changelog openssl | head
rpm -qp --scripts mytool-1.2-1.el10.x86_64.rpm
OptionQuestion it answers
-qaWhich packages are installed?
-qi PKGWhat is this package (version, vendor, size)?
-ql PKGWhich files does it have?
-qc PKG / -qd PKGWhich config / doc files?
-qf FILEWhich package owns this file?
-qp FILE.rpmAsk a package file that is not installed yet
--scriptsWhich scripts run at install and removal?

12.8

Check packages for changes

rpm -V compares the installed files with the package. rpm -K checks the signature of a package file.

rpm -V openssh-server
S.5....T.  c /etc/ssh/sshd_config
rpm -Va 2> /dev/null | grep -v ' c '
rpm -K mytool-1.2-1.el10.x86_64.rpm
rpm -qa gpg-pubkey*

In the rpm -V output, S = size changed, 5 = content changed, T = time changed, c = config file. A changed config file is normal; a changed program in /usr/bin is a warning sign.

Let op

Use rpm -ivh only when you must. It does not get dependencies and does not write the DNF history. Prefer dnf install ./FILE.rpm.

Oefenen

Alle commando's in dit hoofdstuk