CentOS/RHEL has a new package manager called DNF which can be used to install packages on CentOS/RHEL 8 systems. DNF or Dandified YUM is the next-generation version of the Yellowdog Updater Modified (yum), a package manager for rpm-based distributions in CentOS/RHEL 8. It also resolves dependencies automatically.
The following is an example of how to use DNF to check which repositories are enabled and to then install a package from an enabled repository.
1. To check the list of repositories enabled on the system, do:
# dnf repolist This system is receiving updates from Spacewalk server. Last metadata expiration check: 0:56:04 ago on Fri 26 Jul 2019 03:12:16 AM EDT. repo id repo name status el8_x86_64_appstream RedHat Linux 8 Application Stream Packages (x86_64) 6,470 el8_x86_64_baseos_latest RedHat Linux 8 BaseOS Latest (x86_64) 2,166
2. To install a specific package, do the following:
# dnf install httpd This system is receiving updates from Spacewalk server. Last metadata expiration check: 0:08:48 ago on Fri 26 Jul 2019 03:12:16 AM EDT. Dependencies resolved. ============================================================================================================================================================================================================================================= Package Arch Version Repository Size ============================================================================================================================================================================================================================================= Installing: httpd x86_64 2.4.37-10.0.2.module+el8+5189+8bc260ed ol8_x86_64_appstream 1.4 M Installing dependencies: mailcap noarch 2.1.48-3.el8 ol8_x86_64_baseos_latest 39 k oracle-logos-httpd noarch 80.5-1.0.3.el8 ol8_x86_64_baseos_latest 27 k mod_http2 x86_64 1.11.3-1.module+el8+5189+8bc260ed ol8_x86_64_appstream 156 k apr x86_64 1.6.3-9.el8 ol8_x86_64_appstream 125 k httpd-filesystem noarch 2.4.37-10.0.2.module+el8+5189+8bc260ed ol8_x86_64_appstream 34 k apr-util x86_64 1.6.1-6.el8 ol8_x86_64_appstream 105 k httpd-tools x86_64 2.4.37-10.0.2.module+el8+5189+8bc260ed ol8_x86_64_appstream 101 k Enabling module streams: <<<<<<<<<<<<<<<<<<<<<<<<<<< httpd module steam has been enabled on system httpd 2.4 Transaction Summary ============================================================================================================================================================================================================================================= Install 8 Packages Total download size: 2.0 M Installed size: 5.5 M
If the package being installed by DNF is a module (such as httpd), DNF will enable the module on the system automatically.
Note: In the example above, the httpd package is installed from the appstream repository. If there are any missing dependencies for the httpd package, DNF will install these automatically rather than prompting the user to approve their install. In the example below we can see multiple additional packages from both the baseos and appstream repository being installed automatically because they are required dependencies of the httpd package.