服务器报错 Error: Failed to synchronize cache for repo 'AppStream'

DDDD,记录一下

阿里云服务器 centOS-8 执行 yum、dnf命令时报错

CentOS-8 - AppStream
Error: Failed to synchronize cache for repo 'AppStream'

 

来吧,修改源

 

1、进入文件目录

cd /etc/yum.repos.d

 

2、修改 CentOS-Base.repo

sudo vim CentOS-Base.repo

  baseurl 改为如下:

[BaseOS]
name=CentOS-$releasever - Base
# baseurl=http://mirrors.cloud.aliyuncs.com/$contentdir/$releasever/BaseOS/$basearch/os/
baseurl=http://mirrors.aliyun.com/centos/8-stream/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

 

3、修改 CentOS-AppStream.repo

sudo vim CentOS-AppStream.repo

  baseurl 改为如下:

[AppStream]
name=CentOS-$releasever - AppStream
# baseurl=http://mirrors.cloud.aliyuncs.com/$contentdir/$releasever/AppStream/$basearch/os/
baseurl=http://mirrors.aliyun.com/centos/8-stream/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

 

4、删除完后清除并制作缓存

dnf clean all # 清除所有的缓存文件

dnf makecache # 制作元数据缓存

 

5、重新 yum、dnf 命令即可

 

6、Over

 

  

posted @ 2022-05-18 15:30  林诺欧巴  阅读(5166)  评论(0编辑  收藏  举报