系统:CentOS7.9 问题描述:配置yum源时,在/etc/yum.repos.d/目录下配置好.repo文件后,执行yumrepolist all报警[Errno 14] HTTPS Error 404 - Not Found,如下所示: total 4 drwxr-xr-x.2 root root 220 Jul 29 10:41 bak -rw-r--r--.1 root root 194 Jul 29 13:41 centos.repo [centos7] name=centos7 baseurl=https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/ enabled=1 gpgkey=https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/RPM-GPG-KEY-CentOS-7 Loadedplugins: fastestmirror, langpacks Loadingmirror speeds from cached hostfile https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/repodata/repomd.xml:[Errno 14] HTTPSError 404 - Not Found Tryingother mirror. Toaddress this issue please refer to the below wiki article https://wiki.centos.org/yum-errors https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/repodata/repomd.xml:[Errno 14] HTTPS Error 404 - Not Found Tryingother mirror. repoid repo name status centos7 centos7 enabled: 0 repolist:0 解决方案: 1、 删除原.repo文件 rm:remove regular file ‘centos.repo’? yes total 0 drwxr-xr-x.2 root root 220 Jul 29 10:41 bak 2、 卸载原yum包 说明:其实这里该包已经是最新的rpm包,不过此处想卸载后重新安装 [root@hisdg01~]# rpm -qa yum yum-3.4.3-168.el7.centos.noarch [root@hisdg01~]# rpm -e --nodeps yum-3.4.3-168.el7.centos.noarch 3、 下载最新rpm包 4、 安装yum包 [root@hisdg01~]# rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm [root@hisdg01~]# rpm -ivh yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm [root@hisdg01~]# rpm -ivh yum-3.4.3-168.el7.centos.noarch.rpm [root@hisdg01~]# rpm -qa yum yum-3.4.3-168.el7.centos.noarch 5、 导入证书 6、 添加阿里源 Resolvingmirrors.aliyun.com (mirrors.aliyun.com)... 119.84.36.248, 119.84.36.242,119.84.36.239, ... Connectingto mirrors.aliyun.com (mirrors.aliyun.com)|119.84.36.248|:80... connected. HTTPrequest sent, awaiting response... 200 OK Length:2523 (2.5K) [application/octet-stream] Savingto: ‘/etc/yum.repos.d/CentOS-Base.repo’ 100%[======================================================================================================>]2,523 --.-K/s in 0.001s 2022-07-2914:16:30 (3.23 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2523/2523] 7、清除缓存并生成新缓存 [root@hisdg01~]# yum clean all Loadedplugins: fastestmirror, langpacks Cleaningrepos: base extras updates Cleaningup list of fastest mirrors [root@hisdg01~]# yum makecache Loadedplugins: fastestmirror, langpacks Determiningfastest mirrors * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com base |3.6 kB 00:00:00 extras | 2.9 kB 00:00:00 updates | 2.9 kB 00:00:00 (1/10):base/7/x86_64/group_gz | 153 kB 00:00:00 (2/10):extras/7/x86_64/filelists_db | 277 kB 00:00:00 (3/10):extras/7/x86_64/other_db |148 kB 00:00:00 base/7/x86_64/filelists_db FAILED ] 1.2 MB/s | 4.4 MB 00:00:33 ETA http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/d6d94c7d406fe7ad4902a97104b39a0d8299451832a97f31d71653ba982c955b-filelists.sqlite.bz2:[Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connectiontimed out" Tryingother mirror. (4/10):base/7/x86_64/other_db | 2.6 MB 00:00:03 extras/7/x86_64/primary_db FAILED ] 1.2 MB/s | 5.1 MB 00:00:31 ETA http://mirrors.aliyuncs.com/centos/7/extras/x86_64/repodata/68cf05df72aa885646387a4bd332a8ad72d4c97ea16d988a83418c04e2382060-primary.sqlite.bz2:[Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connectiontimed out" Tryingother mirror. base/7/x86_64/primary_db FAILED = ]1.5 MB/s | 16 MB 00:00:18 ETA http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/repodata/6d0c3a488c282fe537794b5946b01e28c7f44db79097bb06826e1c0c88bad5ef-primary.sqlite.bz2:[Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com;Unknown error" Tryingother mirror. (5/10):extras/7/x86_64/primary_db | 247 kB 00:00:00 (6/10):updates/7/x86_64/filelists_db | 9.1 MB 00:00:11 (7/10):base/7/x86_64/filelists_db |7.2 MB 00:00:08 updates/7/x86_64/primary_db FAILED =======- ]1.7 MB/s | 22 MB 00:00:12 ETA http://mirrors.cloud.aliyuncs.com/centos/7/updates/x86_64/repodata/59e299f8058df845fde7a3d6cf0deb765762e02688692ee0682a24377bb047f9-primary.sqlite.bz2:[Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com;Unknown error" Tryingother mirror. updates/7/x86_64/other_db FAILED http://mirrors.cloud.aliyuncs.com/centos/7/updates/x86_64/repodata/789cde875fe6737c803fa587bc13b481c0b31829bfee8fad29d3f4b35c8c6244-other.sqlite.bz2:[Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com;Unknown error" Tryingother mirror. (8/10):updates/7/x86_64/other_db | 1.1 MB 00:00:01 (9/10):base/7/x86_64/primary_db |6.1 MB 00:00:07 (10/10):updates/7/x86_64/primary_db | 16 MB 00:00:18 MetadataCache Created 此时可以看到在/etc/yum.repos.d/目录下自动生成CentOS-Base.repo文件 total 4 drwxr-xr-x.2 root root 220 Jul 29 10:41 bak -rw-r--r--.1 root root 2523 Dec 26 2020CentOS-Base.repo /etc/yum.repos.d #CentOS-Base.repo # # Themirror system uses the connecting IP address of the client and the # updatestatus of each mirror to pick mirrors that are updated to and #geographically close to the client. Youshould use this for CentOS updates # unlessyou are manually picking other mirrors. # # If themirrorlist= does not work for you, as a fall back you can try the #remarked out baseurl= line instead. # # [base] name=CentOS-$releasever- Base - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #releasedupdates [updates] name=CentOS-$releasever- Updates - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #additionalpackages that may be useful [extras] name=CentOS-$releasever- Extras - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #additionalpackages that extend functionality of existing packages [centosplus] name=CentOS-$releasever- Plus - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #contrib- packages by Centos Users [contrib] name=CentOS-$releasever- Contrib - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
|