1、删除或者备份之前的.repo文件,然后执行如下命令
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
rpm -Uvh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
2、执行如下命令
yum makecache
yum repolist
3、看到如下结果,则yum源和epel源正常
# yum makecache
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
epel/metalink | 4.7 kB 00:00
* epel: mirror01.idc.hinet.net
base | 3.7 kB 00:00
base/filelists_db | 6.4 MB 00:03
epel | 4.3 kB 00:00
epel/group_gz | 150 kB 00:00
epel/filelists_db | 7.7 MB 00:02
epel/updateinfo | 746 kB 00:00
epel/primary_db | 5.9 MB 00:02
epel/other_db | 2.9 MB 00:01
extras | 3.4 kB 00:00
extras/filelists_db | 25 kB 00:00
extras/prestodelta | 1.3 kB 00:00
extras/other_db | 30 kB 00:00
updates | 3.4 kB 00:00
updates/filelists_db | 1.6 MB 00:00
updates/prestodelta | 66 kB 00:00
updates/other_db | 34 MB 00:12
Metadata Cache Created
[root@localhost yum.repos.d]# ls
CentOS6-Base.repo epel.repo epel-testing.repo
[root@localhost yum.repos.d]# yum repolist
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* epel: mirror01.idc.hinet.net
repo id repo name status
base CentOS-6 - Base - 163.com 6,706
*epel Extra Packages for Enterprise Linux 6 - x86_64 12,372
extras CentOS-6 - Extras - 163.com 45
updates CentOS-6 - Updates - 163.com 447
repolist: 19,570