首页 > 代码库 > CentOS6.4配置163的yum源

CentOS6.4配置163的yum源

CentOS系统自带的更新源的速度实在是慢,为了让CentOS6使用速度更快的YUM更新源,可以选择163(网易)的更新源。

1.下载repo文件

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

2.备份并替换系统的repo文件

  1. [root@localhost ~]# cd /etc/yum.repos.d/
  2. [root@localhost ~]# mv CentOS-Base.repo CentOS-Base.repo.bak
  3. [root@localhost ~]# mv CentOS6-Base-163.repo CentOS-Base.repo

3.执行yum源更新

  1. [root@localhost ~]# yum clean all
  2. [root@localhost ~]# yum makecache
  3. [root@localhost ~]# yum update

贴出Centos 6.4 32位的配置文件, 如果没有需要手工创建就可以了
[root@bogon ~]# cat /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
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

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

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

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

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

[root@bogon ~]# cat /etc/yum.repos.d/CentOS-Debuginfo.repo
# CentOS-Debug.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.
#

# All debug packages from all the various CentOS-5 releases
# are merged into a single repo, split by BaseArch
#
# Note: packages in the debuginfo repo are currently not signed
#

[debug]
name=CentOS-6 - Debuginfo
baseurl=http://debuginfo.centos.org/6/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-6
enabled=0



[root@bogon ~]# cat /etc/yum.repos.d/CentOS-Vault.repo
# CentOS-Vault.repo
#
# CentOS Vault holds packages from previous releases within the same CentOS Version
# these are packages obsoleted by the current release and should usually not
# be used in production
#-----------------

[C6.0-base]
name=CentOS-6.0 - Base
baseurl=http://vault.centos.org/6.0/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0

[C6.0-updates]
name=CentOS-6.0 - Updates
baseurl=http://vault.centos.org/6.0/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0

[C6.0-extras]
name=CentOS-6.0 - Extras
baseurl=http://vault.centos.org/6.0/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0

[C6.0-contrib]
name=CentOS-6.0 - Contrib
baseurl=http://vault.centos.org/6.0/contrib/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0

[C6.0-centosplus]
name=CentOS-6.0 - CentOSPlus
baseurl=http://vault.centos.org/6.0/centosplus/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0
#-----------------

[C6.1-base]
name=CentOS-6.1 - Base
baseurl=http://vault.centos.org/6.1/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0

[C6.1-updates]
name=CentOS-6.1 - Updates
baseurl=http://vault.centos.org/6.1/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0

[C6.1-extras]
name=CentOS-6.1 - Extras
baseurl=http://vault.centos.org/6.1/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0

[C6.1-contrib]
name=CentOS-6.1 - Contrib
baseurl=http://vault.centos.org/6.1/contrib/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0

[C6.1-centosplus]
name=CentOS-6.1 - CentOSPlus
baseurl=http://vault.centos.org/6.1/centosplus/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0
#-----------------

[C6.2-base]
name=CentOS-6.2 - Base
baseurl=http://vault.centos.org/6.2/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0

[C6.2-updates]
name=CentOS-6.2 - Updates
baseurl=http://vault.centos.org/6.2/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0

[C6.2-extras]
name=CentOS-6.2 - Extras
baseurl=http://vault.centos.org/6.2/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0

[C6.2-contrib]
name=CentOS-6.2 - Contrib
baseurl=http://vault.centos.org/6.2/contrib/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0

[C6.2-centosplus]
name=CentOS-6.2 - CentOSPlus
baseurl=http://vault.centos.org/6.2/centosplus/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0
#-----------------

[C6.3-base]
name=CentOS-6.3 - Base
baseurl=http://vault.centos.org/6.3/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0

[C6.3-updates]
name=CentOS-6.3 - Updates
baseurl=http://vault.centos.org/6.3/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0

[C6.3-extras]
name=CentOS-6.3 - Extras
baseurl=http://vault.centos.org/6.3/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0

[C6.3-contrib]
name=CentOS-6.3 - Contrib
baseurl=http://vault.centos.org/6.3/contrib/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0

[C6.3-centosplus]
name=CentOS-6.3 - CentOSPlus
baseurl=http://vault.centos.org/6.3/centosplus/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0
 
 
 
  

然后我把163的源CentOS-Base-163.repo放在了/etc/yum.repos.d下,然后 yum makecache报错

  • [root@zzming yum.repos.d]# yum makecache
  • Loaded plugins: fastestmirror, refresh-packagekit, security
  • Loading mirror speeds from cached hostfile
  • * addons: mirrors.163.com
  • * base: mirrors.btte.net
  • * extras: mirrors.btte.net
  • * updates: mirrors.btte.net
  • http://mirrors.163.com/centos/6/addons/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
  • Trying other mirror.
  • http://mirror.centos.org/centos/6/addons/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
  • Trying other mirror.
  • Error: Cannot retrieve repository metadata (repomd.xml) for repository: addons. Please verify its path and try again

下载地址:http://mirrors.163.com/.help/CentOS6-Base-163.repo

按照上面的方法替换 搞定

如果还报错误 说明你的.repo  里面的路径不对  需要根据错误找出路径,然后将改文件删除,或者移除  。

CentOS6.4配置163的yum源