且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Redhat 或者centos 更换第三方epel源

更新时间:2022-01-23 06:37:44

官方epel源安装命令:

1
# yum -y install epel-release

安装EPEL 阿里云源


1、备份(如有配置其他epel)

1
2
3
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
 
mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup


2、下载新repo /etc/yum.repos.d/


epel(RHEL 7)

 

1
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo


 

epel(RHEL 6)

 

1
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo


3、清理并重新建立缓存

1
2
yum clean all
yum makecache


国内yum源的安装(163,阿里云,epel)


阿里云镜像源

1、备份

1
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup


2、下载新的CentOS-Base.repo /etc/yum.repos.d/


CentOS 6

1
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo


或者

1
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo


CentOS 7

1
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

或者

1
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo


3、之后运行

1
2
  
yum clean all && yum makecache

 生成缓存

163镜像源


第一步:备份你的原镜像文件,以免出错后可以恢复。


mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup


第二步:下载新的CentOS-Base.repo /etc/yum.repos.d/


CentOS 6

1
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo

CentOS 7

1
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo

3、之后运行 

1
yum clean all && yum makecache

 生成缓存


本文转自 喵来个鱼 51CTO博客,原文链接:http://blog.51cto.com/m51cto/1964880,如需转载请自行联系原作者