2.6 Managing Software with DNF (dnf): A Comprehensive Guide

2.6 Managing Software with DNF (dnf): A Comprehensive Guide

Managing software on a Linux system is a crucial task for system administrators and users alike. DNF (Dandified YUM) is a package manager used in Fedora and other RPM-based Linux distributions. In this guide, we'll explore various commands and operations to efficiently handle software using dnf.

Checking and Upgrading Software

  • Check for upgrades:

      dnf check-upgrade
    
  • Upgrade installed packages:

      sudo dnf upgrade
    

Repository Management

  • Check repository list:

      sudo dnf repolist
    

    or

      sudo dnf repolist -v
    
  • List all repositories (enabled and disabled):

      sudo dnf repolist --all
    
  • Enable/Disable a repository:

      sudo dnf config-manager --enable repo_name
      sudo dnf config-manager --disable repo_name
    
  • Add a new repository:

      sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
    
  • Remove a repository:

      sudo rm /etc/yum.repos.d/docker-ce.repo
    

Package Management

  • Search for packages:

      sudo dnf search packageName
    

    For more accuracy:

      sudo dnf search 'packageName'
    
  • Get information about a package:

      sudo dnf info packageName
    
  • Install a package:

      sudo dnf install packageName
    
  • Reinstall a package:

      sudo dnf reinstall packageName
    
  • Uninstall or remove a package:

      sudo dnf remove packageName
    
  • Group Operations:

    • Install a group of packages:

        sudo dnf group install 'packageName'
      
    • List available groups:

        sudo dnf group list
        sudo dnf group list --hidden
      
    • Remove a group of packages:

        sudo dnf group remove 'packageName'
      

Local Package Operations

  • Install a local RPM file:

      sudo dnf install ./packageName.rpm
    
  • Remove a locally installed package:

      sudo dnf remove packageName.rpm
    

Dependency Management

  • Remove unnecessary dependencies:

      sudo dnf autoremove
    

File Management

  • Identify file origin (for troubleshooting):

      dnf provides /etc/anacrontab
    

    After identifying an issue with a file (e.g., bad edits), reinstall the package:

      sudo rm /etc/anacrontab
      dnf reinstall cronie-anacron
    
  • View all files in a package (installed or not):

      dnf repoquery -l packageName
    

This comprehensive guide should empower users and administrators to efficiently manage software on their Linux systems using the versatile dnf package manager.

Did you find this article valuable?

Support Vijay Kumar Singh by becoming a sponsor. Any amount is appreciated!