• 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. hdparm: command not found
  2. tail command examples in UNIX/Linux
  3. How to work with multiple java versions under Linux
  4. How to Configure rsyslog to Filter/discard Specific IP Address in CentOS/RHEL 6,7
  5. How to use the ssh-keygen Command in Linux
  6. pvmove Command Examples in Linux
  7. Understanding the rc Scripts in Linux
  8. mv: command not found
  9. ddcutil Command Examples in Linux
  10. How to Mirror Swap, Boot and Root Partions in CentOS/RHEL 7 Using mdadm Utility

You May Also Like

Primary Sidebar

Recent Posts

  • ncat Command Examples in Linux
  • ncat: command not found
  • nautilus Command Examples in Linux
  • namei: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright