• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to install packages using dnf in CentOS/RHEL 8

by admin

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.

Filed Under: CentOS/RHEL 8, Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL : Beginners guide to vsftpd (installation and configuration)
  2. “The requested URL returned error: 403 Forbidden” – yum update error
  3. How to Use “repoquery” Command to List Package Dependencies
  4. How to Change Time Interval to Fall Back to Secondary DNS Server in CentOS/RHEL
  5. Understanding How Umask Controls the Initial File / Directory Permissions in Linux
  6. CentOS / RHEL : How to exclude kernel or other packages from getting updated using YUM Versionlock Plugin
  7. How to Install Apache, MariaDB, and PHP (FAMP) stack on FreeBSD 11
  8. Interview Questions : Linux Package Manager (RPM)
  9. Command ntpstat Shows unsynchronised (CentOS/RHEL)
  10. Rpm: Error While Loading Shared Libraries: Libz.so.1: Cannot Open Shared Object File: No Such File

You May Also Like

Primary Sidebar

Recent Posts

  • qemu-system-x86_64: command not found
  • timedatectl: command not found
  • mpirun.openmpi: command not found
  • startkde: command not found

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright