现在开源的yum 有ustc和163。从网上直接下载的repo文件,运行会报错,手工的修改了一下:

 

使用的是ustc的yum,配置文件如下:

[root@web1 yum.repos.d]# cat ustc.repo

 

[base]

name=CentOS-5.9 - Base -mirrors.ustc.edu.cn

baseurl=http://mirrors.ustc.edu.cn/centos/5.9/os/$basearch/

gpgcheck=0

enabled=1

 

#released updates

[updates]

name=CentOS-5.9 - Updates -mirrors.ustc.edu.cn

baseurl=http://mirrors.ustc.edu.cn/centos/5.9/updates/$basearch/

gpgcheck=0

enabled=1

 

#additional packages thatmay be useful

[extras]

name=CentOS-5.9 - Extras -mirrors.ustc.edu.cn

baseurl=http://mirrors.ustc.edu.cn/centos/5.9/extras/$basearch/

gpgcheck=0

enabled=1

 

配置好以后,执行yum update,报错:Error performing checksum

 

[root@web1 yum.repos.d]# yum update

Loaded plugins: katello, product-id,security, subscription-manager

Updating certificate-based repositories.

Unable to read consumer identity

base                                                                                                        | 3.7 kB     00:00    

base/primary_db                                                                                              |4.4 MB     00:02    

http://mirrors.ustc.edu.cn/centos/6.4/os/x86_64/repodata/1e584feac3f3fb76ad4b6fb7e1bc8d44fa124814e9d186dc913ded3c63a216b3-primary.sqlite.bz2:[Errno -3] Error performingchecksum

Trying other mirror.

base/primary_db                                                                                             | 4.4 MB     00:02    

http://mirrors.ustc.edu.cn/centos/6.4/os/x86_64/repodata/1e584feac3f3fb76ad4b6fb7e1bc8d44fa124814e9d186dc913ded3c63a216b3-primary.sqlite.bz2:[Errno -3] Error performing checksum

Trying other mirror.

Error: failure:repodata/1e584feac3f3fb76ad4b6fb7e1bc8d44fa124814e9d186dc913ded3c63a216b3-primary.sqlite.bz2from base: [Errno 256] No more mirrors to try.

 

 

google了一下,说是在rhel 6 中 repomd.xml 文件使用 sha256 作为hash 算法 ,在rhel 5中 默认使用的是sha 作为hash 算法。

 

但我是在redhat 5.8 上使用5.9的yum。 也出现了这种错误。

 

网上的解决方法是:使用新的sha1 来重建repo:

# createrepo -s sha1 dave-el5-x86_64

 

 

我这里没有创建,直接执行如下命令:

# yum clean all

 

 

然后就ok了。  小知识,随笔记之。