Back up the original configuration file

Go to the yum source configuration directory: CD /etc/yum.repos

Sudo yum install wget

Repo centos-base. Repo sudo mv centos-base. Repo centos-base

Download the new configuration file

Wget: yum (centos-base. Repo) Currently, there are three main yum sources in China:

I recommend uSTC, whether centos or Ubuntu

Ali cloud

CentOS7

sudo wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
Copy the code

CentOS6

sudo wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
Copy the code

CentOS5

sudo wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
Copy the code

netease

CentOS7

sudo wget -O CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
Copy the code

CentOS6

sudo wget -O CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo
Copy the code

CentOS5

sudo wget -O CentOS-Base.repo http://mirrors.163.com/.help/CentOS5-Base-163.repo
Copy the code

USTC

CentOS7

sudo wget -O CentOS-Base.repo https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos? codeblock=3Copy the code

CentOS6

sudo wget -O CentOS-Base.repo https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos? codeblock=2Copy the code

CentOS5

sudo wget -O CentOS-Base.repo https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos? codeblock=1Copy the code

Updating metadata

Start by clearing the original metadata cache

sudo yum clean all
Copy the code

Update the new metadata cache

sudo yum makecache
Copy the code