1. Back up the file before modification
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
2. modify and update the source configuration file(Centos6 address, similar to other versions)
Vim open the configuration file:
vim /etc/yum.repos.d/CentOS-Base.repo
Copy and paste the following content to the configuration file:
# CentOS-Base.repo## The mirror system uses the connecting IP address of the client and the# update status of each mirror to pick mirrors that are updated to and# geographically close to the client. You should use this for CentOS updates# unless you are manually picking other mirrors.## If the mirrorlist= does not work for you, as a fall back you can try the# remarked out baseurl= line instead.##[base]name=CentOS-$releasever - Basebaseurl=http://mirrors.oschina.com/centos/$releasever/os/$basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6[updates]name=CentOS-$releasever - Updatesbaseurl=http://mirrors.oschina.com/centos/$releasever/updates/$basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6[addons]name=CentOS-$releasever - Addonsbaseurl=http://mirrors.oschina.com/centos/$releasever/addons/$basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6[extras]name=CentOS-$releasever - Extrasbaseurl=http://mirrors.oschina.com/centos/$releasever/extras/$basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6[centosplus]name=CentOS-$releasever - Plusbaseurl=http://mirrors.oschina.com/centos/$releasever/centosplus/$basearch/gpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
Finally, save the configuration file.
3. Update Yum source configuration
yum update
(If you do not want to update the software, select n)
(Source: http://www.cnblogs.com/shockerli/p/3716893.html)