【Linux server】yum 安装git报错Errors during downloading metadata for repository......

193 阅读1分钟

前言

今天发现服务器没有装git,用yum安装git的时候因为网络的原因总是失败,想到了切换一下yum的源,切了之后呢发现报错:Errors during downloading metadata for repository 'AppStream'

解决方案

阿里的镜像站有变化:developer.aliyun.com/mirror/cent…
解决思路就是删除之前的repo文件,下载新的repo文件。

cd /etc/yum.repos.d/

清空文件

rm -rf *

下载新的阿里云镜像

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo

生成缓存

yum makecache

yum正常!

image.png

安装git

yum -y install git

image.png

搞定!