Centos yum的源 設置為阿里雲源


阿里巴巴鏡像站頁面,在centos 操作的幫助,有介紹 wgetcurl 2種方式來下載CentOS-Base.repo

  1. 備份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
  1. 下載新的CentOS-Base.repo 到/etc/yum.repos.d/

2.1. CentOS-Base.repo 在阿里巴巴鏡像站的鏈接

CentOS 5: http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6: http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7: http://mirrors.aliyun.com/repo/Centos-7.repo

使用 wget 軟件進行下載

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

或者使用 curl 軟件進行下載

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

或者直接下載 對應版本的CentOS-Base.repo文件,在本地使用編輯器打開,將本地打開的CentOS-Base.repo文件所有內容都復制到 centos的/etc/yum.repos.d/CentOS-Base.repo文件中去

  1. 運行 yum makecache 命令生成緩存
References
  1. 阿里巴巴鏡像站頁面 點擊列表的centos行的操作列,點擊"幫助" 就會彈出設置教程咧


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM