一、为什么修改yum源?
众所周知,yum源如果是官方国外的,下载速度很慢(几十Kb/s),修改为国内的就好很多。
修改为阿里云的源
# 先备份源文件,防止出错
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
&&
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo #这里的7可以改为想要的版本
更新缓存
yum makecache
如果没有wget,就yum -y install wget
修改为清华大学的源
# 对于 CentOS 7
sudo sed -e 's|^mirrorlist=|#mirrorlist=|g' \
-e 's|^#baseurl=http://mirror.centos.org/centos|baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos|g' \
-i.bak \
/etc/yum.repos.d/CentOS-*.repo
更新软件包缓存
sudo yum makecache
引用:
https://mirrors.tuna.tsinghua.edu.cn/help/centos/ 清华大学开源软件镜像站
https://www.cnblogs.com/zhangzhiqin/p/9973636.html