详情页

阿里云centos 8: Failed to synchronize cache for repo ‘AppStream’

时间:2022年03月25日

编辑:佚名

阿里云centos8.0执行yum指令出现Error:Failed to synchronize cache for repo 'AppStream'
解决方法:修改/etc/yum.repos.d下的“CentOS-AppStream.repo”“CentOS-Base.repo”“CentOS-Extras.repo”“CentOS-PowerTools.repo”。
# CentOS-AppStream.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.
#
#

[AppStream]
name=CentOS-8.5.2111 - AppStream - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/AppStream/$basearch/os/
              http://mirrors.aliyuncs.com/centos-vault/8.5.2111/AppStream/$basearch/os/
              http://mirrors.cloud.aliyuncs.com/centos-vault/8.5.2111/AppStream/$basearch/os/
gpgcheck=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
# 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.
#
#

[BaseOS]
name=CentOS-$releasever - Base
baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/BaseOS/$basearch/os/
              http://mirrors.aliyuncs.com/centos-vault/8.5.2111/BaseOS/$basearch/os/
              https://mirrors.aliyun.com/centos/8-stream/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
# CentOS-Extras.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.
#
#

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/extras/$basearch/os/
              http://mirrors.aliyuncs.com/centos-vault/8.5.2111/extras/$basearch/os/
              https://mirrors.aliyun.com/centos/8-stream/extras/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
# CentOS-PowerTools.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.
#
#

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

#CentOS-fasttrack.repo

[fasttrack]
name=CentOS-$releasever - fasttrack
baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/fasttrack/$basearch/os/
              http://mirrors.aliyuncs.com/centos-vault/8.5.2111/fasttrack/$basearch/os/
              https://mirrors.aliyun.com/centos/8-stream/fasttrack/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial


重新执行
yum -y install wget
发现已经解决。
centOS8 yum报错:“Error: Failed to download metadata for repo ‘AppStream’: Cannot pre”解决
原因
因为centOS8于2021年12月31日停止了源的服务,而现在时间是2022年2月10日,所以之前的方法都不行的原因所在(本质是源的问题)。
解决
1。一定要先做下面这步,百度了很多,只有下面这步有用。
cd /etc/yum.repos.d/
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
yum update -y
问题:这步可能报错Errors during downloading metadata for repository 'AppStream': - Curl error (28): Timeout was reached for http://vault.centos.org/centos/8/AppStream/x86_64/os/repodata/repomd.xml [Connection timed out after 30003 milliseconds]
解决:
乔汉卿:解决Errors during downloading metadata for repository 'AppStream': Curl error (28): Timeout was reache
2。然后置换源可以用
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
yum clean all
yum makecache(注意如果你不做第一步,这步依然报错)
3。yum list
就能看到 all mirrors,开始随意安装吧。
参考:https://zhuanlan.zhihu.com/p/469500685
阿里云开源镜像站地址:https://mirrors.aliyun.com/repo/
相关文章
猜你需要