CentOS修改yum源
Linux拥有众多的发行版,每个发行版默认由官方提供软件包源。但是,系统默认的官方镜像服务器在遥远的国外,偶尔会遇到网络延迟等原因导致下载速度极其缓慢。为了解决此问题,小鸟云特别提供了镜像源,并与官方镜像保持同步。
下面以修改 CentOS 软件包源为小鸟云官方源为例进行说明(国内镜像服务器地址/香港镜像服务器地址):
1、备份原配置文件
mv -f /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.backup
2、下载小鸟云官方 repo 文件到 /etc/yum.repos.d/
国内节点:
CentOS 5
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.niaoyun.com/repo/CentOS5-Base.repo
CentOS 6
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.niaoyun.com/repo/CentOS6-Base.repo
CentOS 7
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.niaoyun.com/repo/CentOS7-Base.repo
epel
curl -o /etc/yum.repos.d/epel.repo http://mirrors.niaoyun.com/repo/epel.repo
香港节点:
CentOS 5
curl -o /etc/yum.repos.d/CentOS-Base.repo http://hk.mirrors.niaoyun.com/repo/CentOS5-Base.repo
CentOS 6
curl -o /etc/yum.repos.d/CentOS-Base.repo http://hk.mirrors.niaoyun.com/repo/CentOS6-Base.repo
CentOS 7
curl -o /etc/yum.repos.d/CentOS-Base.repo http://hk.mirrors.niaoyun.com/repo/CentOS7-Base.repo
epel
curl -o /etc/yum.repos.d/epel.repo http://mirrors.niaoyun.com/repo/epel.repo
3、刷新缓存
yum clean all;yum makecache