在RHEL5.0中我们配置YUM的时候可能会遇到下面的问题
在RHEL5.3和5.4中我还没有遇到这个问题
[root@localhost ~]# yum install samba
Loading "rhnplugin" plugin
Loading "installonlyn" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Setting up repositories
rhel-debuginfo 100% |=========================| 1.3 kB 00:00
Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 663 kB 00:00
################################################## 2113/2113
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for samba to pack into transaction set.
media://1170972069.396645%232/samba-3.0.23c-2.i386.rpm:
[Errno 4] IOError:
Trying other mirror.
Error: failed to retrieve samba-3.0.23c-2.i386.rpm from rhel-debuginfo
error was [Errno 4]
IOError:
出现在这种情况应该是我们的YUM数据库文件和依赖关系没有弄好,下面我们就分两部来实现库文件的生成和生成依赖关系
1:生成库文件
首先我们先创建一个或者用已有的文件夹来存放库文件,这里我们就用/etc/yum这个目录来存放库文件
接着我们来执行如下操作来生成库文件
首先挂载光盘:
[root@localhost ~]# mount /dev/hdc /mnt
mount: block device /dev/hdc is write-protected, mounting read-only
[root@localhost ~]# rpm -ivh /mnt/Server/createrepo-0.4.4-2.fc6.noarch.rpm
warning: /mnt/Server/createrepo-0.4.4-2.fc6.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:createrepo ########################################### [100%]
[root@localhost ~]# createrepo -o /etc/yum -g /mnt/Server/repodata/comps-rhel5-server-core.xml /mnt/Server/
2113/2113 - zsh-html-4.2.6-1.i386.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@localhost ~]# mount --bind /etc/yum/repodata/ /mnt/Server/repodata/
然后编辑/etc/yum.repos.d/rhel-debuginfo.repo
[root@localhost ~]# vi /etc/yum.repos.d/rhel-debuginfo.repo
[rhel-debuginfo]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=file:///mnt/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
保存并退出
[root@localhost ~]# yum clean all
[root@localhost ~]# yum makecache
Loading "rhnplugin" plugin
Loading "installonlyn" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up repositories
rhel-debuginfo 100% |=========================| 1.3 kB 00:00
filelists.xml.gz 100% |=========================| 2.1 MB 00:00
################################################## 2113/2113
other.xml.gz 100% |=========================| 4.7 MB 00:00
################################################## 2113/2113
Metadata Cache Created
这样就可以了我们再来安装一个软件测试一下
[root@localhost ~]# yum install samba -y
成功了!
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/27042095/viewspace-759639/ ,如需转载,请注明出处,否则将追究法律责任。