Feng’ Blog

将Centos的yum源更换为阿里源
centos7默认的源的网址mirrorlist.centos.org,属于国外的网站,可能出现连不上或者网速很慢...
扫描右侧二维码阅读全文
07
2018/01

将Centos的yum源更换为阿里源

centos7默认的源的网址mirrorlist.centos.org,属于国外的网站,可能出现连不上或者网速很慢的情况。

系统yum源的目录: /etc/yum.repos.d

查看系统使用了哪些yum源

yum repolist 或者 yum repoinfo


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

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 makecache生成缓存


推荐国内其他不错的源:

中科大的yum源

wget http://centos.ustc.edu.cn/CentOS-Base.repo

sohu的yum源

wget http://mirrors.sohu.com/help/CentOS-Base-sohu.repo

163网易的yum源:

wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

Last modification:January 8th, 2019 at 10:35 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment