在 阿里巴巴鏡像站頁面,在centos
操作的幫助,有介紹 wget
和curl
2種方式來下載CentOS-Base.repo
- 備份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
- 下載新的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
文件中去
- 運行
yum makecache
命令生成緩存
References
- 阿里巴巴鏡像站頁面 點擊列表的
centos
行的操作列,點擊"幫助" 就會彈出設置教程咧