CentOS7 使用阿里更新源

不说废话了直接show脚本

请先切换到root权限用户

cp /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
wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-7.repo 
yum clean all  
yum makecache 

上面的脚本直接执行就可以将更新源替换成阿里的了.


脚本含义

cp /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
下载并设置更新源为aliyun
wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-7.repo
下载并设置EPEL源,此源中包含更多的软件
yum clean all
清理yum缓存
yum makecache
创建yum缓存

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容