系统:CentOS 7.9
应用场景:安装数据库时,此前一直用的本地系统镜像处理安装包,直到有次在客户那里实施DG的搭建,需要配置其它的yum源.当时是遇到一些问题的,所以就有了这次配置ali源的实验测试,加深对此部分知识点的理解.
问题描述:配置yum源时,在/etc/yum.repos.d/目录下配置好.repo文件后,执行yum repolist all报警[Errno 14] HTTPS Error 404 - Not Found,如下所示:
[root@hisdg01 yum.repos.d]# ll
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
[root@hisdg01 yum.repos.d]# cat 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
[root@hisdg01 yum.repos.d]# yum repolist all
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below wiki article
https://wiki.centos.org/yum-errors
If above article doesn't help to resolve this issue please use https://bugs.centos.org/.
https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
repo id repo name status
centos7 centos7 enabled: 0
repolist: 0复制
解决方案:
1、删除原.repo文件
[root@hisdg01 yum.repos.d]# rm centos.repo
rm: remove regular file ‘centos.repo’? yes
[root@hisdg01 yum.repos.d]# ll
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包
[root@hisdg01 ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
[root@hisdg01 ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
[root@hisdg01 ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.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、导入证书
[root@hisdg01 ~]# rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7复制
6、添加阿里源
[root@hisdg01 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
--2022-07-29 14:16:30-- http://mirrors.aliyun.com/repo/Centos-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 119.84.36.248, 119.84.36.242, 119.84.36.239, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|119.84.36.248|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2523 (2.5K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’
100%[======================================================================================================>] 2,523 --.-K/s in 0.001s
2022-07-29 14:16:30 (3.23 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2523/2523]复制
7、清除缓存并生成新缓存
[root@hisdg01 ~]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: base extras updates
Cleaning up list of fastest mirrors
[root@hisdg01 ~]# yum makecache
Loaded plugins: fastestmirror, langpacks
Determining fastest 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; Connection timed out"
Trying other 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; Connection timed out"
Trying other 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"
Trying other 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"
Trying other 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"
Trying other 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
Metadata Cache Created复制
此时可以看到在/etc/yum.repos.d/目录下自动生成CentOS-Base.repo文件
[root@hisdg01 yum.repos.d]# ll
total 4
drwxr-xr-x. 2 root root 220 Jul 29 10:41 bak
-rw-r--r--. 1 root root 2523 Dec 26 2020 CentOS-Base.repo
[root@hisdg01 yum.repos.d]# pwd
/etc/yum.repos.d
[root@hisdg01 yum.repos.d]# cat CentOS-Base.repo
# CentOS-Base.repo
#
# 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 - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages 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/
http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
http://mirrors.cloud.aliyuncs.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/
http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7复制
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
评论
相关阅读
2025年3月中国数据库排行榜:PolarDB夺魁傲群雄,GoldenDB晋位入三强
墨天轮编辑部
1423次阅读
2025-03-11 17:13:58
【专家观点】罗敏:从理论到真实SQL,感受DeepSeek如何做性能优化
墨天轮编辑部
1165次阅读
2025-03-06 16:45:38
DeepSeek R1助力,腾讯AI代码助手解锁音乐创作新
若城
1153次阅读
2025-03-05 09:05:00
01. HarmonyOS Next应用开发实践与技术解析
若城
1148次阅读
2025-03-04 21:06:20
【专家有话说第五期】在不同年龄段,DBA应该怎样规划自己的职业发展?
墨天轮编辑部
1143次阅读
2025-03-13 11:40:53
03 HarmonyOS Next仪表盘案例详解(二):进阶篇
若城
1138次阅读
2025-03-04 21:08:36
05 HarmonyOS NEXT高效编程秘籍:Arkts函数调用与声明优化深度解析
若城
1131次阅读
2025-03-04 22:46:06
04 高效HarmonyOS NEXT编程:ArkTS数据结构优化与属性访问最佳实践
若城
1128次阅读
2025-03-04 21:09:35
02 HarmonyOS Next仪表盘案例详解(一):基础篇
若城
1124次阅读
2025-03-04 21:07:43
06 HarmonyOS Next性能优化之LazyForEach 列表渲染基础与实现详解 (一)
若城
1117次阅读
2025-03-05 21:09:40