CentOS更换YUM源
前言
查看当前YUM(Yellow dog Updater, Modified)配置,如果像下图一样使用国外地址,由于网络限制下载会比较慢,更换国内yum源来解决。
cat /etc/yum.repos.d/CentOS-Base.repo
更换为阿里云YUM源
echo "备份原来的源" > /dev/null
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
echo "下载、替换为阿里云源配置" > /dev/null
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
echo "更新yum缓存" > /dev/null
yum clean all
yum makecache