执行 yum install git 报如下错误
Failed to set locale, defaulting to C.UTF-8
CentOS Linux 8 - AppStream 115 B/s | 38 B 00:00
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
解决需要修改yum源地址
cd etc/yum.repos.d/
[root@70688fdb51e8 /]# cd etc/yum.repos.d/
[root@70688fdb51e8 yum.repos.d]# ls
CentOS-Linux-AppStream.repo CentOS-Linux-Debuginfo.repo CentOS-Linux-FastTrack.repo CentOS-Linux-Plus.repo
CentOS-Linux-BaseOS.repo CentOS-Linux-Devel.repo CentOS-Linux-HighAvailability.repo CentOS-Linux-PowerTools.repo
CentOS-Linux-ContinuousRelease.repo CentOS-Linux-Extras.repo CentOS-Linux-Media.repo CentOS-Linux-Sources.repo
修改CentOS-Linux-AppStream.repo CentOS-Linux-BaseOS.repo CentOS-Linux-Extras.repo 这三个文件中的baseurl
baseurl=https://vault.centos.org/centos/$releasever/BaseOS/$basearch/os/
注释掉
#mirrorlist=http://mirrorlist.centos.org/release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra
清除yum缓存: yum clean all
生成yum缓存: yum makecache
最后再执行: yum install git git安装成功