1.卸载rhel的yum相关的包
[root@virhost ~]# rpm -qa|grep yum
yum-updatesd-3.0.1-5.el5 yum-3.0.1-5.el5 yum-rhn-plugin-0.5.2-3.el5 yum-metadata-parser-1.0-8.fc6 yum-security-1.0.4-3.el5 [root@virhost ~]# yum update Loading "rhnplugin" plugin Loading "installonlyn" plugin Loading "security" plugin This system is not registered with RHN. RHN support will be disabled. Setting up Update Process Setting up repositories No Repositories Available to Set Up Reading repository metadata in from local files Skipping security plugin, no data No Packages marked for Update/Obsoletion [root@virhost ~]# rpm -e yum-3.0.1-5.el5 --nodeps [root@virhost ~]# rpm -qa|grep yum yum-metadata-parser-1.0-8.fc6 yum-updatesd-3.0.1-5.el5 yum-rhn-plugin-0.5.2-3.el5 yum-security-1.0.4-3.el5 [root@virhost ~]# rpm -e yum-updatesd-3.0.1-5.el5 [root@virhost ~]# rpm -e yum-rhn-plugin-0.5.2-3.el5 [root@virhost ~]# rpm -e yum-metadata-parser-1.0-8.fc6(后来测试这个不应该卸载) [root@virhost ~]# rpm -e yum-security-1.0.4-3.el5 2.安装centos的源
[url]http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-3.0.5-1.el5.centos.5.noarch.rpm[/url]
rpm -ivh yum-3.0.5-1.el5.centos.5.noarch.rpm
[root@virhost ~]# wget [url]http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-3.0.5[/url]-
1.el5.centos.5.noarch.rpm
[root@virhost ~]# rpm -ivh yum-3.0.5-1.el5.centos.5.noarch.rpm warning: yum-3.0.5-1.el5.centos.5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID e8562897 error: Failed dependencies: yum-metadata-parser is needed by yum-3.0.5-1.el5.centos.5.noarch [root@virhost ~]# wget [url]http://192.168.1.250/yum-metadata-parser-1.0-8.fc6.i386.rpm[/url] --07:48:55-- [url]http://192.168.1.250/yum-metadata-parser-1.0-8.fc6.i386.rpm[/url] Connecting to 192.168.1.250:80... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:22950 (22K) [text/plain] Saving to: `yum-metadata-parser-1.0-8.fc6.i386.rpm'
100%[==================================================================>] 22,950 --.-K/s in
0.003s
07:48:55 (8.57 MB/s) - `yum-metadata-parser-1.0-8.fc6.i386.rpm' saved [22950/22950]
[root@virhost ~]# rpm -ivh yum-metadata-parser-1.0-8.fc6.i386.rpm
warning: yum-metadata-parser-1.0-8.fc6.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 Preparing... ########################################### [100%] 1:yum-metadata-parser ########################################### [100%] [root@virhost ~]# rpm -ivh yum-3.0.5-1.el5.centos.5.noarch.rpm warning: yum-3.0.5-1.el5.centos.5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID e8562897 Preparing... ########################################### [100%] 1:yum ########################################### [100%] 由此看来yum-metadata-parser-1.0-8.fc6.i386.rpm这个包不应该删除那 [root@virhost ~]# cd /etc/yum.repos.d/ [root@virhost yum.repos.d]# ls rhel-debuginfo.repo [root@virhost yum.repos.d]# vi CentOS-Base.repo这个文件内如是下面的
[base]
name=CentOS-5.1 - Base baseurl=http://mirror.tini4u.net/centos/5.1/os/$basearch/ [url]http://centos.ustc.edu.cn/centos/5.1/os/$basearch/[/url] gpgcheck=0 gpgkey=http://centos.ustc.edu.cn/centos/5.1/os/i386/RPM-GPG-KEY-CentOS-5
#released updates
[updates] name=CentOS-5.1 - Updates baseurl=http://centos.ustc.edu.cn/centos/5.1/os/$basearch/ [url]http://centos.ustc.edu.cn/centos/5.1/os/$basearch/[/url] gpgcheck=0 gpgkey=http://centos.ustc.edu.cn/centos/5.1/os/i386/RPM-GPG-KEY-CentOS-5 #packages used/produced in the build but not released [addons] name=CentOS-5.1 - Addons baseurl=http://centos.ustc.edu.cn/centos/5.1/os/$basearch/ [url]http://centos.ustc.edu.cn/centos/5.1/os/$basearch/[/url] gpgcheck=0 gpgkey=http://centos.ustc.edu.cn/centos/5.1/os/i386/RPM-GPG-KEY-CentOS-5 #additional packages that may be useful [extras] name=CentOS-5.1 - Extras baseurl=http://centos.ustc.edu.cn/centos/5.1/os/$basearch/ [url]http://centos.ustc.edu.cn/centos/5.1/os/$basearch/[/url] gpgcheck=0 gpgkey=http://centos.ustc.edu.cn/centos/5.1/os/i386/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5.1 ¨C Plus baseurl=http://centos.ustc.edu.cn/centos/5.1/os/$basearch/ [url]http://centos.ustc.edu.cn/centos/5.1/os/$basearch/[/url] gpgcheck=0 gpgkey=http://centos.ustc.edu.cn/centos/5.1/os/i386/RPM-GPG-KEY-CentOS-5
#contrib - packages by Centos Users
[contrib] name=CentOS-5.1 - Contrib baseurl=http://centos.ustc.edu.cn/centos/5.1/os/$basearch/ [url]http://centos.ustc.edu.cn/centos/5.1/os/$basearch/[/url] gpgcheck=0 gpgkey=http://centos.ustc.edu.cn/centos/5.1/os/i386/RPM-GPG-KEY-CentOS-5 然后随便测试了一个命令 [root@virhost yum.repos.d]# rpm -qa|grep postfix 刚好系统没有装这个包 [root@virhost yum.repos.d]# yum install postfix Loading "installonlyn" plugin Setting up Install Process Setting up repositories updates 100% |=========================| 1.1 kB 00:00 contrib 100% |=========================| 1.1 kB 00:00 centosplus 100% |=========================| 1.1 kB 00:01 addons 100% |=========================| 1.1 kB 00:00 extras 100% |=========================| 1.1 kB 00:00 Reading repository metadata in from local files primary.xml.gz 100% |=========================| 834 kB 00:03 ################################################## 2400/2400 primary.xml.gz 100% |=========================| 834 kB 00:08 ################################################## 2400/2400 primary.xml.gz 100% |=========================| 834 kB 00:08 ################################################## 2400/2400 primary.xml.gz 100% |=========================| 834 kB 00:04 ################################################## 2400/2400 primary.xml.gz 100% |=========================| 834 kB 00:08 ################################################## 2400/2400 Parsing package install arguments Resolving Dependencies --> Populating transaction set with selected packages. Please wait. ---> Downloading header for postfix to pack into transaction set. postfix-2.3.3-2.i386.rpm 100% |=========================| 41 kB 00:00 ---> Package postfix.i386 2:2.3.3-2 set to be updated --> Running transaction check
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size ============================================================================= Installing: postfix i386 2:2.3.3-2 extras 3.6 M
Transaction Summary
============================================================================= Install 1 Package(s) Update 0 Package(s) Remove 0 Package(s)
Total download size: 3.6 M
Downloading Packages: (1/1): postfix-2.3.3-2.i3 100% |=========================| 3.6 MB 00:43 Running Transaction Test warning: postfix-2.3.3-2: Header V3 DSA signature: NOKEY, key ID e8562897 Finished Transaction Test Transaction Test Succeeded Running Transaction Installing: postfix ######################### [1/1]
Installed: postfix.i386 2:2.3.3-2
Complete! |