解決RHEL5.0中YUM的配置檔案

perfychi發表於2013-05-02
Normal 0 7.8 磅 0 2 false false false EN-US ZH-CN X-NONE解決RHEL5.0YUM的配置檔案

 

RHEL5.0中我們配置YUM的時候可能會遇到下面的問題

RHEL5.35.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

--&gt Populating transaction set with selected packages. Please wait.

---&gt Downloading header for samba to pack into transaction set.

media://1170972069.396645%232/samba-3.0.23c-2.i386.rpm: [Errno 4] IOError: unknown url type: media>

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/

[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

成功了!

 

 

 

 

 

相關文章