Package Management¶
Prerequisites¶
- Root or sudo privileges
- Network connectivity for repository access
Quick Reference¶
| Action | Command |
|---|---|
| Search | dnf search <term> |
| Find by command | dnf provides */bin/<command> |
| Info | dnf info <pkg> |
| List Installed | dnf list installed |
| Install | dnf install <pkg> |
| Remove | dnf remove <pkg> |
| Update | dnf update |
| Clean Cache | dnf clean all |
| History | dnf history |
Procedure: Search for a Package¶
When to use: You need a tool but don't know the exact package name.
Steps:
-
Search by name or description:
dnf search <keyword> -
Find which package provides a specific command:
Output showsdnf provides */bin/digbind-utils— the package that contains thedigbinary.This works for any command. For example, to find who provides
htpasswd:dnf provides */bin/htpasswd -
Get detailed information about a package:
dnf info <package_name> -
List all installed packages:
dnf list installed
Troubleshooting:
- "No matches found": Try a broader keyword, or use
dnf provides */<command>without thebin/prefix.
Procedure: Install a Package¶
When to use: Installing new software from configured repositories.
Steps:
-
Install a package:
dnf install <package_name> -
Install a specific version:
dnf install <package_name>-<version> -
Confirm installation:
rpm -q <package_name>
Troubleshooting:
- "Unable to find a match": Check spelling, or try searching first. The package might require an extra repository (like EPEL).
Procedure: Update All Packages¶
When to use: Routine system maintenance to apply security patches and bug fixes.
Steps:
-
Check for available updates:
dnf check-update -
Install all updates:
dnf update -y -
(Optional) Update only security-related packages:
dnf update --security
Troubleshooting:
- Slow downloads: Mirrors might be slow.
Ctrl+Cand retry, or clean cache.
Procedure: Clean Package Cache¶
When to use: Metadata is stale, checksum errors, or freeing up disk space.
Steps:
-
Clean all cached metadata and packages:
dnf clean all -
Rebuild the cache (happens automatically on next dnf command, but can be forced):
dnf makecache
Troubleshooting:
- If
dnfis still broken after cleaning: Check internet connectivity and DNS.
Procedure: Add a Repository¶
When to use: Installing software not present in standard repositories (e.g., EPEL, Docker).
Steps:
-
Install EPEL (Extra Packages for Enterprise Linux):
dnf install epel-release -
Add a custom repo via config-manager:
dnf config-manager --add-repo <url_to_repo> -
Verify the new repo is enabled:
dnf repolist
Troubleshooting:
- "404 Not Found": The repo URL might be incorrect or not support your OS version.
Related Documentation¶
- Concepts: Package Management