不說廢話了直接show腳本
請先切換到root權(quán)限用戶
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum makecache
上面的腳本直接執(zhí)行就可以將更新源替換成阿里的了.
腳本含義
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
備份原始的更新源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
下載并設(shè)置更新源為aliyun
wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-7.repo
下載并設(shè)置EPEL源,此源中包含更多的軟件
yum clean all
清理yum緩存
yum makecache
創(chuàng)建yum緩存