Manage DNF Package Repositories

This section provides a tutorial example on how to manage DNF Package Repositories on CentOS systems.

What Is DNF Package Repository? - A DNF Package Repository is a remote server that provides software packages ready to be installed on your local computer using the DNF package manager.

By default, DNF comes with a number of repositories pre-defined in the /etc/yum.repos.d/ directory:

herong$ sudo ls -l /etc/yum.repos.d

-rw-r--r--. 1 root root  731 Jan  2  2020 CentOS-AppStream.repo
-rw-r--r--. 1 root root  712 Jan  2  2020 CentOS-Base.repo
-rw-r--r--. 1 root root  756 Jan  2  2020 CentOS-Extras.repo
....

DNF also provides a number of commands for you to manage repositories.

1. List all enabled repositories using the "dnf repolist" command:

herong$ sudo dnf repolist

repo id     repo name               status
AppStream   CentOS-8 - AppStream     5,058
BaseOS      CentOS-8 - Base          1,695
extras      CentOS-8 - Extras           30
...

2. Add a new repository using the "dnf config-manager --add-repo" command. For example:

herong$ sudo dnf config-manager --add-repo \
  https://repos.azul.com/zing/rhel/zing.repo

  Adding repo from: https://repos.azul.com/zing/rhel/zing.repo

(Or put the *.repo file directly into /etc/yum.repos.d/)
herong$ sudo curl -o /etc/yum.repos.d/zing.repo \
  https://repos.azul.com/zing/rhel/zing.repo

herong$ sudo dnf repolist
  repo id     repo name                                              status
  ...
  zing        zing-8 - Azul Systems Inc., Zing packages for x86_64   256

3. Disable a repository using the "dnf config-manager --set-disabled" command. More repositories enabled requires longer search time! For example:

herong$ sudo dnf config-manager --set-disabled zing

(you can enable it later)
herong$ sudo dnf config-manager --set-enabled zing

4. Some third party repositories put their *.repo files in DNF default repositories, so that they can be installed as "normal" packages. For example:

herong$ sudo dnf search epel
  epel-release.noarch : Extra Packages for Enterprise Linux repository
    configuration

herong$ sudo dnf install epel-release
  Installed:
    epel-release-8-8.el8.noarch

6. Some other third party repositories put their *.repo files in RPM (RedHat Package Manager) files. In this case, you need to download and install it using the RPM tool. For example:

herong$ curl http://repo.iotti.biz/CentOS/8/noarch/lux-release-8-1.noarch.rpm \
  > lux-release-8-1.noarch.rpm

herong$ ls -l
-rw-rw-r--. 1 herong herong 16104 lux-release-8-1.noarch.rpm

herong$ sudo rpm -U lux-release-8-1.noarch.rpm

herong$ dnf repolist
  repo id   repo name                 status
  ...
  lux       CentOS 8 - x86_64 - Lux   226

Here is a list of software package repositories for CentOS systems compiled by https://centos.pkgs.org.

Aeris
Atomic
CERT Forensics Tools
CentOS *
Cheese
Docker CE Stable
ELRepo *
EPEL *
End Point
Galaxy4
GetPageSpeed
Ghettoforge *
Harbottle *
IUS Community Packages *
Les RPM de Remi
Lux
MongoDB 4.2
MySQL *
Nginx
Nux *
OKey
Open Fusion
Percona
PostgreSQL *
RPM Fusion *
Raven *
Repoforge (RPMforge)
Springdale *
Trinity R14
VirtualBox
Webtatic

Table of Contents

 About This Book

 Introduction to Linux Systems

 Cockpit - Web Portal for Administrator

 Process Management

 Files and Directories

 Users and Groups

 File Systems

 Block Devices and Partitions

 LVM (Logical Volume Manager)

 Installing CentOS

 SELinux - Security-Enhanced Linux

 Network Connection on CentOS

 Internet Networking Tools

 SSH Protocol and ssh/scp Commands

Software Package Manager on CentOS - DNF and YUM

 What Is DNF

Manage DNF Package Repositories

 What Is YUM

 What Is RPM

 What Is pkgs.org

 Install and Manage Java Packages on CentOS

 Install and Manage Perl Packages on CentOS

 Install "git-core" for GitHub Packages on CentOS

 Failed to Download Metadata for Repo ...

 Replacing CentOS Repositories to Local Mirrors

 vsftpd - Very Secure FTP Daemon

 LDAP (Lightweight Directory Access Protocol)

 Administrative Tasks

 References

 Full Version in PDF/EPUB