CIS126RH | RHEL System Administration 1 Mesa Community College
Learning Objectives
1
Understand RPM packages
Know the RPM package format and naming conventions
2
Manage packages with DNF
Search, install, update, and remove software packages
3
Configure repositories
Enable, disable, and add software repositories
4
Use Application Streams
Work with DNF modules for multiple software versions
Package Management Overview
Repository
→
DNF
→
System
Repositories contain packages → DNF downloads and installs → Software runs on system
RPM
Package format containing software, metadata, and installation scripts
DNF
High-level package manager that handles dependencies automatically
Repository
Collection of packages with metadata, hosted on a server
Module
Set of packages representing an application or version stream
RPM Package Format
An RPM package is a file containing software, metadata (name, version, dependencies), and scripts for installation and removal.
httpd-2.4.57-5.el9.x86_64.rpm
Component
Example
Description
Name
httpd
Software name
Version
2.4.57
Upstream software version
Release
5.el9
Package build number and distribution (el9 = RHEL 9)
Architecture
x86_64
CPU architecture (x86_64, aarch64, noarch)
DNF Basic Commands
Command
Description
dnf search keyword
Search for packages by name or description
dnf info package
Display detailed package information
dnf install package
Install a package and dependencies
dnf remove package
Remove a package
dnf update
Update all installed packages
dnf update package
Update a specific package
dnf list installed
List all installed packages
dnf list available
List packages available to install
dnf provides /path/file
Find which package provides a file
Searching for Packages
# Search by keyword (searches name and description)[root@server ~]# dnf search web server
======================== Name & Summary Matched: web, server =========================
httpd.x86_64 : Apache HTTP Server
nginx.x86_64 : A high performance web server and reverse proxy server# Search only in package names[root@server ~]# dnf search --names-only httpd
# Get detailed information about a package[root@server ~]# dnf info httpd
Name : httpd
Version : 2.4.57
Release : 5.el9
Architecture : x86_64
Size : 59 k
Source : httpd-2.4.57-5.el9.src.rpm
Repository : rhel-9-for-x86_64-appstream-rpms
Summary : Apache HTTP Server
URL : https://httpd.apache.org/
License : ASL 2.0# Find what package provides a command[root@server ~]# dnf provides /usr/bin/vim
vim-enhanced-2:9.0.1712-1.el9.x86_64 : A version of the VIM editor which includes recent enhancements
Repo : rhel-9-for-x86_64-appstream-rpms
Matched from:
Filename : /usr/bin/vim
Installing Packages
# Install a single package[root@server ~]# dnf install httpd
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
httpd x86_64 2.4.57-5.el9 rhel-9-appstream 59 k
Installing dependencies:
apr x86_64 1.7.0-11.el9 rhel-9-appstream 127 k
apr-util x86_64 1.6.1-20.el9 rhel-9-appstream 98 k
httpd-filesystem x86_64 2.4.57-5.el9 rhel-9-appstream 18 k
httpd-tools x86_64 2.4.57-5.el9 rhel-9-appstream 84 k
Transaction Summary
================================================================================
Install 5 Packages
Total download size: 386 k
Is this ok [y/N]: y# Install without confirmation prompt[root@server ~]# dnf install -y nginx
# Install multiple packages[root@server ~]# dnf install vim wget curl
# Install a package group[root@server ~]# dnf group install "Development Tools"
Updating Packages
# Check for available updates[root@server ~]# dnf check-update
kernel.x86_64 5.14.0-362.18.1.el9_3 rhel-9-baseos
openssl.x86_64 1:3.0.7-25.el9_3 rhel-9-baseos
vim-enhanced.x86_64 2:9.0.2081-1.el9 rhel-9-appstream# Update all packages[root@server ~]# dnf update
# Update specific package[root@server ~]# dnf update openssl
# Update with automatic yes[root@server ~]# dnf update -y
# Security updates only[root@server ~]# dnf update --security
# Download updates without installing[root@server ~]# dnf update --downloadonly
# View update changelog[root@server ~]# dnf updateinfo list
[root@server ~]# dnf updateinfo info RHSA-2024:0001
Removing Packages
# Remove a package[root@server ~]# dnf remove httpd
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Removing:
httpd x86_64 2.4.57-5.el9 @rhel-9-appstream 155 k
Removing dependent packages:
mod_ssl x86_64 1:2.4.57-5.el9 @rhel-9-appstream 298 k
Removing unused dependencies:
apr x86_64 1.7.0-11.el9 @rhel-9-appstream 289 k
apr-util x86_64 1.6.1-20.el9 @rhel-9-appstream 211 k
Transaction Summary
================================================================================
Remove 4 Packages# Remove without dependency removal[root@server ~]# dnf remove --noautoremove httpd
# Clean up unneeded dependencies[root@server ~]# dnf autoremove
# Remove a group[root@server ~]# dnf group remove "Development Tools"
⚠ Caution: DNF removes packages that depend on what you're removing. Always review the transaction before confirming!