之前使用阿里云主机默认yum源是阿里云自己的镜像,非阿里云主机可以安装阿里centos发行版源,但是并不是epel源,epel源需要单独安装,这里推荐修改为阿里云或者中科大的epel源,国内连接速度很快,并且更新速度也很快。
中科大帮助文档: https://lug.ustc.edu.cn/wiki/mirrors/help/centos
更换为阿里云发行版镜像: https://opsx.alibaba.com/mirror
更换为阿里云epel镜像: https://opsx.alibaba.com/mirror
找到自己对应系统版本的repo 下载到服务器/etc/yum.repos.d目录,替换CentOS-Base.repo 即可。这里以阿里云yum镜像为例:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo yum makecache #生成缓存
如果修改为中科大镜像后还是存在有的软件包无法找到的情况可以考虑更换为阿里云epel镜像结合使用。
转载请注明:菜鸟运维网 » centos 更换yum源