CentOS 8.x系统停止维护yum无法使用解决方法

2022-03-20 23:08:10
554次阅读
0个评论

2022年1月1日CentOS8已经不在维护了,随之自带的yum源也无法使用,yum安装会报错:Repository AppStream is listed more than once in the configuration Repository extras is listed more than once in the configuration 或者为 repo 'AppStream' 下载元数据失败  错误:为 repo 'AppStream' 下载元数据失败,完整的报错可参考如下信息,本文将介绍如何更改centos8的yum源达到使用的目的。


解决方法:可参考如下方法更换yum源
如果使用的是阿里云的服务器,可参考教程 https://blog.tag.gg/showinfo-3-36184-0.html 操作
1、将/etc/yum.repos.d目录改名备份,并重新创建新的/etc/yum.repos.d目录

mv /etc/yum.repos.d /etc/yum.repos.d.backup

mkdir /etc/yum.repos.d


2、执行如下命令下载阿里云公共的yum镜像文件(wget及crul方式选择其中一种即可)
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo


若服务器提示没安装wget命令,可执行如下命令下载yum源
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo


3、执行如下命令重新创建缓存
yum clean all && yum makecache


若执行没有报错则表示正常,成功的提示可参考如下:
[root@A ~]#  yum clean all && yum makecache
0 文件已删除
CentOS-8.5.2111 - Base - mirrors.aliyun.com                                                                                           4.4 MB/s | 4.6 MB     00:01    
CentOS-8.5.2111 - Extras - mirrors.aliyun.com                                                                                        26 kB/s |  10 kB     00:00    
CentOS-8.5.2111 - AppStream - mirrors.aliyun.com                                                                            4.7 MB/s | 8.4 MB     00:01    
元数据缓存已建立。

随后可测试yum安装软件看是否正常。


收藏00

登录 后评论。没有帐号? 注册 一个。