SoFunction
Updated on 2025-04-08

The problem of using yum command in CentOS system and its solution

CentOS system uses yum command to report an error

Find the file

/etc//

Replace the source file as

# 
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-$releasever - Base - 
failovermethod=priority
baseurl=/centos/$releasever/os/$basearch/
        /centos/$releasever/os/$basearch/
        /centos/$releasever/os/$basearch/
gpgcheck=0
gpgkey=/centos/RPM-GPG-KEY-CentOS-7
 
#released updates 
[updates]
name=CentOS-$releasever - Updates - 
failovermethod=priority
baseurl=/centos/$releasever/updates/$basearch/
        /centos/$releasever/updates/$basearch/
        /centos/$releasever/updates/$basearch/
gpgcheck=0
gpgkey=/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 
failovermethod=priority
baseurl=/centos/$releasever/extras/$basearch/
        /centos/$releasever/extras/$basearch/
        /centos/$releasever/extras/$basearch/
gpgcheck=0
gpgkey=/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 
failovermethod=priority
baseurl=/centos/$releasever/centosplus/$basearch/
        /centos/$releasever/centosplus/$basearch/
        /centos/$releasever/centosplus/$basearch/
gpgcheck=0
enabled=0
gpgkey=/centos/RPM-GPG-KEY-CentOS-7
 
#contrib - packages by Centos Users
#[contrib]
#name=CentOS-$releasever - Contrib - 
#failovermethod=priority
#baseurl=/centos/$releasever/contrib/$basearch/
#        /centos/$releasever/contrib/$basearch/
#        /centos/$releasever/contrib/$basearch/
#gpgcheck=1
#enabled=0
#gpgkey=/centos/RPM-GPG-KEY-CentOS-7

Summarize

The above is personal experience. I hope you can give you a reference and I hope you can support me more.