Centos7/8更换YUM阿里云源

Centos 7 更换源:

** 备份 **

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

下载Repo文件

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

** 完成后执行**

yum clear all
yum makecache

Centos 8 更换源:

** 备份 **

cp /etc/yum.repos.d/CentOS-AppStream.repo /etc/yum.repos.d/CentOS-AppStream.repo_bak
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak
cp /etc/yum.repos.d/CentOS-Extras.repo /etc/yum.repos.d/CentOS-Extras.repo_bak

修改CentOS-AppStream.repo

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra
baseurl=https://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/

修改CentOS-Base.repo

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra
baseurl=https://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/

修改CentOS-Extras.repo

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=https://mirrors.aliyun.com/centos/8.0.1905/extras/x86_64/os/

** 完成后执行**

dnf clear all
dnf makecache

你可能感兴趣的:(Centos7/8更换YUM阿里云源)