CentOS5.7 yum软件源的问题

最近在CentOS5.7系统下用yum直接安装软件时,总是出现如下问题:

loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.ustc.edu.cn
 * extras: centos.ustc.edu.cn
 * updates: centos.ustc.edu.cn
Setting up Install Process
No package xxxx available.
Nothing to do

我要装apache2、php5、mysql sever等,结果都是这个样子的。

上网一查才知道是yum软件源的设置问题了,网上这方面资料很多,无奈,试了一个下午也没有搞定,主要是要修改/etc/yum.repos.d/CentOS-Base.repo的设置,我在网上试了很多方法都不行,主要是镜像网站的问题,国内有合肥科大的、上海一个大学的、163的等等,我都试过了,都没有解决问题啊,现在先记录一些,等以后有空了再搞吧,先用源码包装着。

从http://mirrors.163.com/.help/CentOS-Base-163.repo下载后放到/etc/yum.repos.d/中,将其他的源的文件名后面都直接加个.bak让他们失效,另外把CentOS-Base-163.repo文件中的mirrorlist行注释掉(前面加#),这样保证总是从网易下载。具体命令如下:

#cd /etc/yum.repos.d
[root@filerserver yum.repos.d]#mv CentOS-Base.repo CentOS-Base.repo.bak
[root@filerserver yum.repos.d]#wgethttp://mirrors.163.com/.help/CentOS-Base-163.repo
[root@filerserver yum.repos.d]#mv CentOS-Base-163.repo  CentOS-Base.repo


完成后使用两个命令:

yum clean metadata //清除以前的缓存

yum makecache //重新建立缓存

如果没有出现问题那么就可以了,不过我在“yum makecache”后就出现如下问题:

 http://mirrors.163.com/centos/5/updates/x86_64/repodata/filelists.sqlite.bz2: [Errno -1] Metadata file does not match checksum
Trying other mirror.
adobe-linux-i386                                                         
17/17
base
3566/3566
http://mirrors.163.com/centos/5/extras/x86_64/repodata/primary.sqlite.bz2: [Errno 12] Timeout: <urlopen error timed out>
Trying other mirror.
Error: failure: repodata/primary.sqlite.bz2 from extras: [Errno 256] No more mirrors to try.

不知道怎么搞了,那几个软件还是装不上。

国内的CentOS5 yum源汇总:

1.http://ftp.sjtu.edu.cn/centos/,上海交大,但服务器位于北京,中国教育网网络中心,我看像是朝阳区那边的IP,以前在那边上过班,下载速度高达十M。
北方用户与教育网用户推荐,速度飞快。
CentOS版本也挺多,现在用5.2和5.3的用户较新。
CenOS-Base.repo:无连接,麻烦手动

2.http://centos.ustc.edu.cn,中国科技大学,服务器位于合肥。
南方用户推荐。
同样的,CenOS版本非常丰富,适合长期使用。
CenOS-Base.repo:http://centos.ustc.edu.cn/CentOS-Base.repo

3.http://mirrors.sohu.com ,搜狐的开源软件镜像。
已经有了各种Linux、BSD发行版和MySQL,服务器位于山东网通。

4.http://mirrors.163.com,网易的开源软件镜像


当然也可以自己动手制作CentOS-Base.repo文件,不过我试了试网上的众多方法,也没找到合适的答案。

以下是手动更新YUM配置文件的方法:

修改/etc/yum.repos.d/CentOS-Base.repo:

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

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

#packages used/produced in the build but not released
[addons]
name=CentOS-5 – Addons
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=addons

baseurl=http://ftp.sjtu.edu.cn/centos/5.0/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5

#additional packages that may be useful
[extras]
name=CentOS-5 – Extras
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=extras

baseurl=http://ftp.sjtu.edu.cn/centos/5.0/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5 – Plus
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=centosplus
baseurl=http://ftp.sjtu.edu.cn/centos/5.0/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5

#contrib – packages by Centos Users
[contrib]
name=CentOS-5 – Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=contrib
baseurl=http://ftp.sjtu.edu.cn/centos/5.0/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5

2.执行
64位:
rpm –import http://ftp.sjtu.edu.cn/centos/5.0/os/x86_64/RPM-GPG-KEY-CentOS-5

32位:
rpm –import http://ftp.sjtu.edu.cn/centos/5.0/os/i386/RPM-GPG-KEY-CentOS-5

3.执行
yum update


后来发现CentOS、Fedora系统都是这样的问题,是不是这些软件就不能这样装的呢?


参考网址:

http://zvv.me/linux/501.html

http://hi.baidu.com/jone_linux/blog/item/a86896ca50461593c817687f.html

http://fedoranews.org/tchung/yum-mirrorlist/

http://os.51cto.com/art/201002/184587.htm

http://www.diybl.com/course/6_system/linux/CentOS/20111121/562446.html

http://www.iteye.com/topic/476703

http://lxsym.blog.51cto.com/1364623/770732

http://os.51cto.com/art/201001/178727.htm

http://os.51cto.com/art/201002/182782.htm

http://www.360doc.com/content/10/1022/11/2614615_62964571.shtml

http://blog.c1gstudio.com/archives/863

http://dogdogcom.blog.51cto.com/2402458/499435

http://www.5dlinux.com/article/1/2011/linux_42963.html

http://veryi.com/w/327.html






  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值