1.centos8更换为阿里云yum源

2.更换阿里云Yum-centos8源
mv /etc/yum.repos.d/CentOS-Stream-BaseOS.repo /etc/yum.repos.d/CentOS-Stream-BaseOS.repo.backup
curl -o /etc/yum.repos.d/CentOS-Stream-BaseOS.repo https://mirrors.aliyun.com/repo/Centos-8.repo
wget -O /etc/yum.repos.d/CentOS-Stream-BaseOS.repo https://mirrors.aliyun.com/repo/Centos-8.repo 
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# ls
CentOS-Stream-AppStream.repo      CentOS-Stream-Extras.repo            CentOS-Stream-RealTime.repo          epel.repo
CentOS-Stream-BaseOS.repo         CentOS-Stream-HighAvailability.repo  CentOS-Stream-ResilientStorage.repo  epel-testing-modular.repo
CentOS-Stream-BaseOS.repo.backup  CentOS-Stream-Media.repo             CentOS-Stream-Sources.repo           epel-testing.repo
CentOS-Stream-Debuginfo.repo      CentOS-Stream-NFV.repo               epel-modular.repo
CentOS-Stream-Extras-common.repo  CentOS-Stream-PowerTools.repo        epel-playground.repo
 
3.查询repository列表

4.如果配置后仍然报错 如下
 
 CentOS Stream 8 - Extras common packages                                                                                        0.0  B/s |   0  B     00:00
 Errors during downloading metadata for repository 'extras-common':
   - Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8-stream&arch=x86_64&repo=extras-extras-common [Could not resolve host: mirrorlist.centos.org]
 错误:Failed to download metadata for repo 'extras-common': Cannot prepare internal mirrorlist: Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8-stream&arch=x86_64&repo=extras-extras-common [Could not resolve host: mirrorlist.centos.org]
 [root@localhost ~]#
5.解决方案之干净利索方案
5.1 备份原有yum仓库整个备份
cp -r /etc/yum.repos.d /home/yum.repos.d.bakcup

5.2.进入原有yum源删除里面所有*.repos文件
cd /etc/yum.repos.d
rm -f *.repo 
5.3. 直接覆盖下载阿里云centos-8.0 yum源
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo 
5.4. 更新yum缓存
yum clean all
yum makecache 
OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK


















