CentOS7系统配置国内yum源和epel源

1.首先进入/etc/yum.repos.d/目录下,新建一个repo_bak目录,用于保存系统中原来的repo文件

[root@node01 ~]# cd /etc/yum.repos.d/
[root@node01 yum.repos.d]# yum -y install wget
[root@node01 yum.repos.d]# mkdir repo_bak
[root@node01 yum.repos.d]# mv *.repo repo_bak/

2.在CentOS中配置使用网易和阿里的开源镜像
到网易和阿里开源镜像站点下载系统对应版本的repo文件

[root@node01 yum.repos.d]# wget http://mirrors.aliyun.com/repo/Centos-7.repo
[root@node01 yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
[root@node01 yum.repos.d]# ls
CentOS7-Base-163.repo  Centos-7.repo  repo_bak
[root@node01 yum.repos.d]# yum clean all 
[root@node01 yum.repos.d]# yum makecache

查看系统可用的yum源和所有的yum源

[root@node01 yum.repos.d]# yum repolist enabled 
已加载插件:fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
源标识                                                                    源名称                                                                                 状态
base/7/x86_64                                                             CentOS-7 - Base - 163.com                                                              10,097
extras/7/x86_64                                                           CentOS-7 - Extras - 163.com                                                               323
updates/7/x86_64                                                          CentOS-7 - Updates - 163.com                                                            1,117
repolist: 11,537
原文地址:https://www.cnblogs.com/liujunjun/p/12260198.html