引言:最近使用centos的yum源安裝依賴時出現(xiàn)了一些問題,同事建議換成國內(nèi)的阿里的源。
步驟如下
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
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
3愿吹、之后運行yum makecache生成緩存
補充說明:默認(rèn)的repo文件在/etc/yum.repos.d/目錄下金踪,
[root@localhost ~]# cd /etc
[root@localhost etc]# ls | grep yum
yum
yum.conf
yum.repos.d
[root@localhost etc]# cd yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Base.repo? CentOS-Debuginfo.repo? CentOS-Media.repo? ? CentOS-Vault.repo? epel-testing.repo
CentOS-CR.repo? ? CentOS-fasttrack.repo? CentOS-Sources.repo? epel.repo
穩(wěn)妥備份也可以在備份之后下載新源之前用下面的命令浊洞,當(dāng)然也可以省略
[root@localhost yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak
---------------------------
其他相關(guān)資料可移步
(1)http://mirrors.aliyun.com/help/centos?spm=5176.bbsr150321.0.0.d6ykiD
(2)https://yq.aliyun.com/articles/33286