Skip to content

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:

  1. Search by name or description:

    dnf search <keyword>
    

  2. Find which package provides a specific command:

    dnf provides */bin/dig
    
    Output shows bind-utils — the package that contains the dig binary.

    This works for any command. For example, to find who provides htpasswd:

    dnf provides */bin/htpasswd
    

  3. Get detailed information about a package:

    dnf info <package_name>
    

  4. List all installed packages:

    dnf list installed
    

Troubleshooting:

  • "No matches found": Try a broader keyword, or use dnf provides */<command> without the bin/ prefix.

Procedure: Install a Package

When to use: Installing new software from configured repositories.

Steps:

  1. Install a package:

    dnf install <package_name>
    

  2. Install a specific version:

    dnf install <package_name>-<version>
    

  3. 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:

  1. Check for available updates:

    dnf check-update
    

  2. Install all updates:

    dnf update -y
    

  3. (Optional) Update only security-related packages:

    dnf update --security
    

Troubleshooting:

  • Slow downloads: Mirrors might be slow. Ctrl+C and retry, or clean cache.

Procedure: Clean Package Cache

When to use: Metadata is stale, checksum errors, or freeing up disk space.

Steps:

  1. Clean all cached metadata and packages:

    dnf clean all
    

  2. Rebuild the cache (happens automatically on next dnf command, but can be forced):

    dnf makecache
    

Troubleshooting:

  • If dnf is 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:

  1. Install EPEL (Extra Packages for Enterprise Linux):

    dnf install epel-release
    

  2. Add a custom repo via config-manager:

    dnf config-manager --add-repo <url_to_repo>
    

  3. Verify the new repo is enabled:

    dnf repolist
    

Troubleshooting:

  • "404 Not Found": The repo URL might be incorrect or not support your OS version.

  • Concepts: Package Management