souhu yum服务器CentOS-Base.repo
将$releasever替换为操作系统版本号
# 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 - sohu.com mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os baseurl=http://mirrors.sohu.com/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #released updates [updates] name=CentOS-$releasever - Updates - sohu.com mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates baseurl=http://mirrors.sohu.com/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #packages used/produced in the build but not released [addons] name=CentOS-$releasever - Addons - sohu.com mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons baseurl=http://mirrors.sohu.com/centos/$releasever/addons/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras - sohu.com mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras baseurl=http://mirrors.sohu.com/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus - sohu.com mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus baseurl=http://mirrors.sohu.com/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib - sohu.com mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib baseurl=http://mirrors.sohu.com/centos/$releasever/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 复制代码 放入/etc/yum.repos.d/ 运行yum makecache生成缓存 清华的5.2单独定义的: CentOS 5.2 清华大学 YUM源 CentOS-Base.repo # CentOS-Base.repo # # This file uses a new mirrorlist system developed by Lance Davis for CentOS. # 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-5 - Base repo=os baseurl=ftp://ftp3.tsinghua.edu.cn/mirror/centos/5.2/os/$basearch/ gpgcheck=1 gpgkey=ftp://ftp3.tsinghua.edu.cn/mirror/centos/RPM-GPG-KEY-CentOS-5 [update] name=CentOS-5 - Updates baseurl=ftp://ftp3.tsinghua.edu.cn/mirror/centos/5.2/updates/$basearch/ gpgcheck=1 gpgkey=ftp://ftp3.tsinghua.edu.cn/mirror/centos/RPM-GPG-KEY-CentOS-5 [addons] name=CentOS-5 - Addons baseurl=ftp://ftp3.tsinghua.edu.cn/mirror/centos/5.2/addons/$basearch/ gpgcheck=1 gpgkey=ftp://ftp3.tsinghua.edu.cn/mirror/centos/RPM-GPG-KEY-CentOS-5 [extras] name=CentOS-5 - Extras baseurl=ftp://ftp3.tsinghua.edu.cn/mirror/centos/5.2/extras/$basearch/ gpgcheck=1 gpgkey=ftp://ftp3.tsinghua.edu.cn/mirror/centos/RPM-GPG-KEY-CentOS-5 [centosplus] name=CentOS-5 - Plus baseurl=ftp://ftp3.tsinghua.edu.cn/mirror/centos/5.2/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=ftp://ftp3.tsinghua.edu.cn/mirror/centos/RPM-GPG-KEY-CentOS-5 [contrib] name=CentOS-5 - Contrib baseurl=ftp://ftp3.tsinghua.edu.cn/mirror/centos/5.2/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=ftp://ftp3.tsinghua.edu.cn/mirror/centos/RPM-GPG-KEY-CentOS-5
然后执行 要用rpm --import ftp://ftp3.tsinghua.edu.cn/mirror/centos/5.0/os/i386/RPM-GPG-KEY-CentOS-5导入,这个文件http://mirrors.sohu.com/centos/6/os/x86_64/也可以下载