如何快速替换linux系统中的yum源

一、备份系统旧配置文件centos

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup缓存

二、获取对应版本的CentOS-Base.repo 到/etc/yum.repos.d/目录
替换以前先备份旧配置ide

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup阿里云

centos各版本的源配置列表
centos5centos7

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos5_base.repoget

centos6it

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos6_base.repoclass

centos7(腾讯yum源)配置

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo
(阿里云yum源)
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo腾讯

更新缓存

yum clean allyum makecache