الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

الفصل 12الاسم في الدورة: 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 الدروس
  • 8 الأوامر
  • 1 المعامل

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

$ مستخدم عادي# بصلاحية root (أو مع sudo)

المهارات في هذا الفصل

  • تثبيت الحزم وتحديثها وحذفها باستخدام DNF و 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

ملاحظة

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

نصيحة للامتحان

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

الأوامر في هذا الدرس

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

في العمل

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

الأوامر في هذا الدرس

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"

الأوامر في هذا الدرس

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

تذكّر

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

انتبه

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.

الأوامر في هذا الدرس

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.

انتبه

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

تدرّب

كل الأوامر في هذا الفصل