1、检查centos中是否有wget(直接输入wget即可,如果没有则进行安装:yum install -y wget)
2、备份原有的源镜像文件
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
3、下载新的CentOS-Base.repo,并写入到基础源文件中
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 国内阿里的镜像
4、YUM缓存生成
yum clean all //清理yum缓存,使设置生效
yum makecache //将服务器上的软件包信息缓存到本地,以提高搜索安装软件的速度
yum -y update //更新本地yum