一、备份原来的yum源,以防后续使用
cd /etc/yum.repos.d/;mkdir bak/; mv *.repo bak/
cd /etc/yum.repos.d/(查看镜像是否已经配置)
进入yum目录
cd /etc/yum.repos.d/
ls查看
2.下载阿里云Centos-7.repo文件(可以根据自己的需求下载不同的镜像源)
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
(centos 7版本)
3.清除yum缓存 :
yum clean all
缓存阿里云镜像 :
yum makecache
测试阿里云镜像:
yum list
最后ls查看是否安装完成
国内知名的yum源镜像站有:
阿里云,网址:https://opsx.alibaba.com/mirr
清华大学,网址:http://mirrors.tuna.tsinghua.edu.cn/
中科大,网址:http://mirrors.ustc.edu.cn/