yum 升级 rhe15
[来源] http://weijia.blog.51cto.com/616222/119673
删除原来的/etc/yum.conf文件和/etc/yum.repo.d目录
生成yum.conf,内容
[root@localhost etc]# cat yum.conf
[main] cachedir=/var/cache/yum keepcache=1 debuglevel=2 logfile=/var/log/yum.log pkgpolicy=newest distroverpkg=redhat-release tolerant=1 exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 metadata_expire=1800 # PUT YOUR REPOS HERE OR IN separate files named file.repo # in /etc/yum.repos.d [base] name=centos-5 - Base baseurl=http://centos.ustc.edu.cn/centos/5/os/i386/ # the other site: [url]http://centos.candishosting.com.cn/centos/5/os/i386/[/url] # you can find more site in: [url]http://www.centos.org/modules/tinycontent/index.php?id=13[/url] enabled=1 gpgcheck=1 gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5 #released updates [update] name=CentOS-5 - Updates baseurl=http://mirror.centos.org/centos/5/updates/i386/ gpgcheck=1 gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5 #packages used/produced in the build but not released [addons] name=CentOS-5 - Addons baseurl=http://mirror.centos.org/centos/5/addons/$basearch/ gpgcheck=1 gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5 #additional packages that may be useful [extras] name=CentOS-5 - Extras baseurl=http://mirror.centos.org/centos/5/extras/$basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-5 - Plus baseurl=http://mirror.centos.org/centos/5/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5 #contrib - packages by Centos Users [contrib] name=CentOS-5 - Contrib baseurl=http://mirror.centos.org/centos/5/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5 #packages in testing [testing] name=CentOS-5 - Testing baseurl=http://mirror.centos.org/centos/5/testing/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://centos.ustc.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5
2008.07.28 更新
1. 安装yum
2. 修改.repo文件
ccd /etc/yum.repos.d/
#vi CentOS-Base.repo
写入以下内容:
[base]
name=CentOS-5 - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever5&arch=$basearch&
repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://ftp.sjtu.edu.cn/centos/5/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#released updates
[update]
name=CentOS-5 - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=updates
baseurl=http://ftp.sjtu.edu.cn/centos/5/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#packages used/produced in the build but not released
[addons]
name=CentOS-5 - Addons
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=addons
baseurl=http://ftp.sjtu.edu.cn/centos/5/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#additional packages that may be useful
[extras]
name=CentOS-5 - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=extras
baseurl=http://ftp.sjtu.edu.cn/centos/5/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5 - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=centosplus
baseurl=http://ftp.sjtu.edu.cn/centos/5/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#contrib - packages by Centos Users
[contrib]
name=CentOS-5 - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=contrib
baseurl=http://ftp.sjtu.edu.cn/centos/5/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
# vi dag.repo
[dag]
name=Dag RPM Repository for RHEL5
baseurl=http://ftp.riken.jp/Linux/dag/redhat/el5/en/$basearch/dag/
enabled=1
gpgcheck=1
gpgkey=http://ftp.riken.jp/Linux/dag/packages/RPM-GPG-KEY.dag.txt
3. 导入key
#rpm --import [url]http://ftp.sjtu.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5[/url]
4. 运行,测试
#yum update
*****************************
让RHEL5也能YUM Centos5.1
2008-04-11 11:02
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 P