CentOS 修改yum源为国内源

参考链接:http://mirrors.aliyun.com/help/centos?spm=5176.bbsr150321.0.0.d6ykiD

  1. 备份源文件
    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

  2. 下载新的CentOS-Base.repo 到/etc/yum.repos.d/ (注:阿里、网易、搜狐任选其一)
    CentOS 5
    阿里: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
    网易: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS5-Base-163.repo
    CentOS 6
    阿里: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
    网易: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo
    CentOS 7
    阿里: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    网易: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo

  3. 生成缓存
    yum makecache

  4. 执行更新
    yum -y update

你可能感兴趣的:(CentOS,yum)