Linux添加yum源,yum下载速度过慢

CentOS系统更换yum软件安装源(此处以网易为例)

第一步:备份你的原镜像文件,以免出错后可以恢复。

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

第二步:下载新的CentOS-Base.repo 到/etc/yum.repos.d/

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo

如果无法下载可copy下面的PS内容

第三步:修改gpgkey

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6,之前的用 “#” 注释


第四步:运行yum makecache生成缓存

yum clean all

yum makecache

本人亲测可以达到5M/s,实际情况根据个人网速。


PS:本日列出已经配置好的repo,大家可以直接复制内容到/etc/yum.repos.d/CentOS-Base.repo 即可使用。


# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
#gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

#released updates 
[updates]
name=CentOS-$releasever - Updates - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
#gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
#gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
#gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
#gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6



你可能感兴趣的:(Linux,yum,centos,Linux)