注册
登录

您现在的位置是:首页 > 学无止境

centos5.1修改yum的源为国内镜像

木木彡82 2009-04-11 21:28:00 1061人围观
昨天下了centos 5.1dvd.iso刚刚装上,要更新的话yum的问题是首先要解决的 。我一边弄我自己的机器一边作个记录。我在上海,根据搜索的结果,把CentOS 5的yum源换为上海交通大学网站很近的。1.修改/etc/yum.repos.d/CentOS-Base.repo为:# Cen...

 昨天下了centos 5.1dvd.iso刚刚装上,要更新的话yum的问题是首先要解决的 。我一边弄我自己的机器一边作个记录。我在上海,根据搜索的结果,把CentOS 5的yum源换为上海交通大学网站很近的。
1.修改/etc/yum.repos.d/CentOS-Base.repo为:
# CentOS-Base.repo

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://ftp.sjtu.edu.cn/centos/5.1/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://ftp.sjtu.edu.cn/centos/5.1/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
baseurl=http://ftp.sjtu.edu.cn/centos/5.1/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful

[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://ftp.sjtu.edu.cn/centos/5.1/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#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://ftp.sjtu.edu.cn/centos/5.1/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
baseurl=http://ftp.sjtu.edu.cn/centos/5.1/contrib/$basearch/
gpgcheck=1
enabled=0
protect=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
 
2.执行
32位:
rpm --import
http://ftp.sjtu.edu.cn/centos/5.1/os/i386/RPM-GPG-KEY-CentOS-5
64位:
rpm --import
http://ftp.sjtu.edu.cn/centos/5.1/os/x86_64/RPM-GPG-KEY-CentOS-5
3.执行
yum update
Ok了,搞定。
yum源的国内服务器还有几个,比如centos官方网站提供的比如 :
http://ftp.hostrino.com/pub/centos/5.1/(香港)
http://mirror.be10.com/centos/5.1/(江苏省苏州市 电信)
http://centos.ustc.edu.cn/centos/5.1/(安徽省合肥市 中国科学技术大学)
http://centos.candishosting.com.cn/5.1/(北京的)
我看到网上的还有清华大学的
ftp://ftp3.tsinghua.edu.cn/mirror/centos/5.1/
大家可以根据自己的地里位置去慢慢确认
大家一定要看清楚版本

文章评论

  • 登录后评论

点击排行