Http://blog.csdn.net/pkueecser/article/details/8836973
Important: storage path
cd /etc/yum.repos.d
Back up CentOS-Base.repo first
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
Method 1: directly download the source file
Centos USTC mirror is a good image. You can update and use this image.
# Yum-y install wget
# Cd/etc/yum. Repos. d
# Mv CentOS-Base.repo CentOS-Base.repo.save
# Wget http://centos.ustc.edu.cn/CentOS-Base.repo
NOTE: If it is the first time to install a new system, you need to first install the wget download software, otherwise there is no way to download the CentOS-Base.repo file.
Method 2: manually create source files
Change the yum image site to the Chinese site address. We recommend that you use http://centos.ustc.edu.cn/centos /. (China University of Science and Technology)
# Cd/etc/yum. Repos. d/
# Mv CentOS-Base.repo CentOS-Base.repo.bak
# Vi CentOS-Base.repo
Save and run
Yum makecache
Generate Cache
[Switch] centos: Change Yum source to domestic