1. 程式人生 > >CentOS更換源

CentOS更換源

-s spa repos data get image bsp back .repo

這裏介紹如何把CentOS默認鏡像源更換為阿裏雲鏡像源

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 7.0)

CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
或者
curl -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 或者 curl -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 或者 curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

技術分享圖片

3、之後先清除緩存再生成緩存

# 清除緩存
yum clean all

# 生存緩存 yum makecache

技術分享圖片

技術分享圖片

  

  

CentOS更換源