هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
$ مستخدم عادي# بصلاحية root (أو مع sudo)
المهارات في هذا الفصل
- تثبيت الحزم وتحديثها وحذفها باستخدام DNF و RPM
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
└────────────────────── nameA repository is a web folder (or a local folder) full of packages plus an index. A registered RHEL 10 system gets two main repositories:
| Repository | What is in it |
|---|---|
| BaseOS | The core of the system: kernel, shell, basic tools, systemd |
| AppStream | Applications, languages and databases: Apache, PHP, Python, PostgreSQL … |
ملاحظة
redhat.repo is written by subscription-manager. Do not edit it by hand: use subscription-manager repos --enable=REPO instead.
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.
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| Command | What it does |
|---|---|
dnf install PKG | Install (asks first; -y answers yes) |
dnf install ./FILE.rpm | Install a local package file — DNF still gets its dependencies |
dnf check-update | Show updates without installing them |
dnf update | Update all packages (dnf upgrade is the same) |
dnf update --security | Only security updates |
dnf remove PKG | Remove a package and the packages that need it |
dnf autoremove | Remove 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.
Install package groups
A group installs a set of packages for one job, for example a desktop or development tools.
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.
Add your own repository
A repository is defined by a small .repo file in /etc/yum.repos.d/.
[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-releasednf 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.
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| Option | Question it answers |
|---|---|
-qa | Which packages are installed? |
-qi PKG | What is this package (version, vendor, size)? |
-ql PKG | Which files does it have? |
-qc PKG / -qd PKG | Which config / doc files? |
-qf FILE | Which package owns this file? |
-qp FILE.rpm | Ask a package file that is not installed yet |
--scripts | Which scripts run at install and removal? |
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.