Centos8.0执行yum指令出现Error :Failed to synchronize cache for repo 'AppStream'.

更新时间
Jan 15, 2023 11:24 PM
记录人
ZeroDoCom

阿里云服务器 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