Managing Packages with dnf (CentOS/AlmaLinux/Rocky)

Managing Packages with dnf

dnf (Dandified YUM) is the package manager for Red Hat-based distributions: CentOS, AlmaLinux, Rocky Linux, and Fedora.

Update Package Lists and Upgrade

dnf update -y

Install a Package

dnf install nginx -y

Remove a Package

dnf remove nginx

Search for a Package

dnf search nginx

Show Package Information

dnf info nginx

List Installed Packages

dnf list installed
dnf list installed | grep php

Enable EPEL Repository

EPEL (Extra Packages for Enterprise Linux) provides many packages not in the default repos:

dnf install epel-release -y

Enable Remi Repository (for latest PHP)

dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm -y
dnf module enable php:remi-8.2 -y

List Available Module Streams

dnf module list

Clean Cache

dnf clean all

Check for Broken Dependencies

dnf check

Downgrade a Package

dnf downgrade nginx

View dnf History

dnf history
dnf history undo last   # Undo last transaction
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Managing Users and Groups

Managing Users and Groups on Linux Proper user management is essential for server security. Avoid...

Managing Services with systemctl

Managing Services with systemctl systemctl is the standard tool for managing services on modern...

Monitoring Server Resources

Monitoring Server Resources Keeping an eye on your server's resource usage helps you identify...

Scheduling Tasks with Cron

Scheduling Tasks with Cron Cron allows you to schedule commands to run automatically at set...

Installing and Configuring Nginx

Installing and Configuring Nginx Nginx is a high-performance web server and reverse proxy widely...