CentOS8 yum and dnf Configuration of Domestic Source

  • 2021-07-06 12:00:41
  • OfStack

CentOS 8 changed the installer for the package, eliminating the configuration method for yum and using dnf as the installer instead. Although the way the package is installed, dnf is compatible with the configuration files and commands used by yum. However, I don't know how long this compatibility configuration will last and whether the domestic mirror path (Alibaba Cloud Image is used here) will be modified, so I added a temporary flag in the title.

There is not much explanation here, just go to the document:


# file: /etc/yum.repos.d/CentOS-AppStream.repo
[AppStream]
name=CentOS-$releasever - AppStream
baseurl=http://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
Copy
# file: /etc/yum.repos.d/CentOS-Base.repo
[BaseOS]
name=CentOS-$releasever - Base
baseurl=http://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
Copy
# file: /etc/yum.repos.d/CentOS-Epel.repo
[epel]
name=CentOS-$releasever - Epel
baseurl=http://mirrors.aliyun.com/epel/8/Everything/$basearch
enabled=1
gpgcheck=0
Copy
# file: /etc/yum.repos.d/CentOS-Media.repo
[c8-media-BaseOS]
name=CentOS-BaseOS-$releasever - Media
baseurl=file:///media/CentOS/BaseOS/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[c8-media-AppStream]
name=CentOS-AppStream-$releasever - Media
baseurl=file:///media/CentOS/AppStream/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

Note: The CentOS-Media configuration requires mounting the disc to the/media/CentOS path, otherwise an error will be reported during use.

Then execute the following command:


dnf clean all #  Clear all cached files 
dnf makecache #  Making metadata cache 

Summarize

The above is the site to introduce the CentOS8 yum/dnf configuration of domestic source method, I hope to help you, if you have any questions welcome to leave me a message, this site will reply to you in time!


Related articles: