Centos6更换阿里源
yum -y install wget
1.首先备份原来的cent os官方yum源
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
2.获取阿里的yum源覆盖本地官方yum源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
3.清理yum缓存,并生成新的缓存
yum clean all
yum makecache
Centos7更换阿里源
yum -y install wget
1.首先备份原版/etc/yum.repos.d/CentOS-Base.repo
cd /etc/yum.repos.d sudo mv CentOS-Base.repo CentOS-Base.repo.bak
2.下载阿里的yum源配置文件,放入/etc/yum.repos.d/CentOS-Base.repo
wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
3.运行yum makecache生成缓存
yum clean all yum makecache
Centos8更换阿里源
yum -y install wget
1、备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
3、生成缓存
yum clean all
yum makecache