1.更换国内源(清华源)
首先备份 CentOS-Base.repo
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo123
使用 su 命令切换到 root 用户,再执行
vim /etc/yum.repos.d/CentOS-Base.repo
向 CentOS-Base.repo 添加下面代码
#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- r e l e a s e v e r − B a s e b a s e u r l = h t t p s : / / m i r r o r s . t u n a . t s i n g h u a . e d u . c n / c e n t o s / releasever - Base baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/ releasever−Basebaseurl=https://mirrors.tuna.tsinghua