redhat almalinux dnf - ghdrako/doc_snipets GitHub Wiki

dnf - Dandified YUM and is basically an improved version of the YUM package manager.

In more recent systems, both yum and dnf actually link to the same executable, dnf-3 – so it does not matter which one is used.

Installation of EPEL repository Redhat 9

$ sudo subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms
$ sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm

Installation of EPEL repository Redhat 8

sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

This will download the repository file to /etc/yum.repos.d/epel.repo and enables it.

on RHEL 8 it is required to also enable the codeready-builder-for-rhel-8-*-rpms repository since EPEL packages may depend on packages from it:

ARCH=$( /bin/arch )
sudo subscription-manager repos --enable "codeready-builder-for-rhel-8-${ARCH}-rpms"

Verify repo install-ation

$ sudo dnf repolist epel
$ sudo dnf repolist epel -v

Search

$ sudo dnf repolist epel
$ sudo dnf --disablerepo="*" --enablerepo="epel" list available # List packages available on EPEL repository.
$ sudo dnf --disablerepo="*" --enablerepo="epel" list available | grep <package>
$ sudo dnf --disablerepo="*" --enablerepo="epel" list available | grep chromium

$ sudo dnf repository-packages epel list
$ sudo dnf repository-packages epel list | grep -i zabbix

Install package from EPEL repository, just run

$ sudo dnf --enablerepo="epel" install <package>
$ sudo dnf --enablerepo="epel" install chromium

$ dnf –enablerepo=”epel” install <pkg_name>
$ sudo dnf --enablerepo="epel" install neofetch -y

Basic DNF commands useful for package management

$ yum install dnf #installs DNF RPM from the yum package manager.
$ dnf –version # This specifies the DNF version.
$ dnf list all or $ dnf list <package-name> # This lists all or specific packages; this example lists the kernel RPM available in the system.
$ dnf check-update or # dnf check-update kernel: This views updates in the system
$ # dnf search <package-name>
$ dnf updateinfo list available or $ dnf updateinfo list available sec # These list all the advisories available in the system; including the sec option will list all advisories labeled "security fix."
$ dnf updateinfo list available sec --sec-severity Critical # This lists all the security advisories in the system marked "critical."
$ dnf updateinfo FEDORA-2018-a86100a264 –info # This verifies the information of any advisory via the --info switch.
$ dnf repolist all # This downloads and lists all enabled repositories in the system.
$ dnf upgrade --security or $ dnf upgrade --sec-severity Critical # This applies all the security advisories available in the system. With the --sec-severity option, you can include the packages with severity marked either Critical, Important, Moderate, or Low.
⚠️ **GitHub.com Fallback** ⚠️