yum

在RHEL6中部署YUM服務器,RHEL5作爲客戶機使用YUM工具時出現錯誤:

ftp://192.168.1.23/rhel5/repodata/primary.xml.gz: [Errno -3] Error performing checksum
Trying other mirror.
Error: failure: repodata/primary.xml.gz from test: [Errno 256] No more mirrors to try.

原因是RHEL6中的repomd.xml文件使用sha256作爲hash算法,在rhel5中默認使用sha作爲hash算法,所以在部署YUM時應指定hash算法爲sha或md5

把RHEL5的鏡像的內容拷貝到/var/ftp/rhel5目錄中,cp  -rfp /mnt/*  /var/ftp/rhel5

掛載rhel6的鏡像  mount /dev/cdrom  /mnt/

[root@localhost rhel5]# createrepo -s sha -g /mnt/repodata/repomd.xml ./
 

[root@rh ~]# cat /etc/yum.repos.d/local.repo
[rhel5]
name=rhel5
baseurl=ftp://192.168.7.1/rhel5
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[root@rh ~]# 
 或者

[root@rh ~]# vi /etc/yum.repos.d/local.repo
[rhel5]
name=rhel5
baseurl=ftp://192.168.7.1/rhel5
enabled=1
gpgcheck=0

 

在客戶機上如果按下面寫在執行YUM命令時會出現:

[root@rh ~]# cat /etc/yum.repos.d/local.repo
[rhel5]
name=rhel5
baseurl=ftp://192.168.7.1/rhel5
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[rhel6]
name=rhel6
baseurl=ftp://192.168.7.1/rhel6
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[root@rh ~]#
[root@rh ~]# yum list vsftpd
Loading "rhnplugin" plugin
Loading "installonlyn" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up repositories
Reading repository metadata in from local files
e677a30bfc993f5f0b66c0899 100% |=========================| 1.3 MB    00:00    
ftp://192.168.7.1/rhel6/repodata/e677a30bfc993f5f0b66c0899817fcaa268512e9c47a64d6d0e9f9d4b9bd7496-primary.xml.gz: [Errno -3] Error performing checksum
Trying other mirror.
Error: failure: repodata/e677a30bfc993f5f0b66c0899817fcaa268512e9c47a64d6d0e9f9d4b9bd7496-primary.xml.gz from rhel6: [Errno 256] No more mirrors to try.
因此在客戶機上只指定與客戶機相匹配的YUM軟件倉庫就可以了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章