【Linux】CentOS修改各大yum源(CentOS7)

    对原配置文件进行备份
cd /etc/yum.repos.d		进入源配置文件目录
cp CentOS-Base.repo CentOS-Base.repo.0		复制配置文件并将其重命名
    若没有下载wget,先使用yum install wget命令下载,一路y + 回车即可 下载新的配置文件 阿里云
yum install wget -y

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
## CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
## CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
## CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

网易云

##CentOS7
wget -O /etc/yum.repos.d/CentOS-Base.repo  http://mirrors.163.com/.help/CentOS7-Base-163.repo
 
##CentOS6
wget -O /etc/yum.repos.d/CentOS-Base.repo  http://mirrors.163.com/.help/CentOS6-Base-163.repo
 
##CentOS5
wget -O /etc/yum.repos.d/CentOS-Base.repo  http://mirrors.163.com/.help/CentOS5-Base-163.repo
    更新元数据
sudo yum clean all		清除原来的元数据
yum makecache		更新新的元数据缓存
yum update -y
经验分享 程序员 微信小程序 职场和发展