redhat 7.2更新yum源时踩的坑
一、update yum
1、先查看redhat7.2中yum的包版本 [root@localhost jiayimeng]# rpm -qa | grep yum yum-rhn-plugin-2.0.1-5.el7.noarch yum-metadata-parser-1.1.4-10.el7.x86_64 yum-langpacks-0.4.2-4.el7.noarch yum-utils-1.1.31-34.el7.noarch yum-3.4.3-132.el7.noarch 2、删除原有的yum包 [root@localhost jiayimeng]# rpm -e yum-rhn-plugin-2.0.1-5.el7.noarch yum-metadata-parser-1.1.4-10.el7.x86_64 yum-langpacks-0.4.2-4.el7.noarch yum-utils-1.1.31-34.el7.noarch yum-3.4.3-132.el7.noarch --nodeps 警告:/etc/yum/pluginconf.d/langpacks.conf 已另存为 /etc/yum/pluginconf.d/langpacks.conf.rpmsave 3、在各大开源镜像站下载对应包 163: aliyun: 中科大: 4、下载并ftp到redhat server [root@localhost jiayimeng]# ll 总用量 1472 -rw-r--r--. 1 root root 1288436 12月 22 17:13 yum-3.4.3-154.el7.centos.noarch.rpm -rw-r--r--. 1 root root 28348 12月 22 17:13 yum-metadata-parser-1.1.4-10.el7.x86_64.rpm -rw-r--r--. 1 root root 32776 12月 22 17:13 yum-plugin-fastestmirror-1.1.31-42.el7.noarch.rpm -rw-r--r--. 1 root root 25592 12月 22 17:13 yum-updateonboot-1.1.31-42.el7.noarch.rpm -rw-r--r--. 1 root root 120184 12月 22 17:13 yum-utils-1.1.31-42.el7.noarch.rpm 5、安装软件包 [root@localhost jiayimeng]# rpm -ivh yum-* 警告:yum-3.4.3-154.el7.centos.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY 错误:依赖检测失败: python-urlgrabber >= 3.10-8 被 yum-3.4.3-154.el7.centos.noarch 需要 rpm >= 0:4.11.3-22 被 yum-3.4.3-154.el7.centos.noarch 需要 6、报错,依赖包的版本不符 解决方案有两个,一是在网上找低版本rpm包安装,二是将所依赖的python-urlgrabber和rpm包升级,我这里用第二个方法 ----下载---- [root@localhost jiayimeng]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-4.11.3-25.el7.x86_64.rpm --2017-12-22 17:18:59-- http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-4.11.3-25.el7.x86_64.rpm 正在解析主机 mirrors.163.com (mirrors.163.com)... 123.58.190.235, 123.58.190.228, 123.58.190.236, ... 正在连接 mirrors.163.com (mirrors.163.com)|123.58.190.235|:80... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:1216680 (1.2M) [application/x-redhat-package-manager] 正在保存至: “rpm-4.11.3-25.el7.x86_64.rpm” 100%[====================>] 1,216,680 2.29MB/s 用时 0.5s 2017-12-22 17:19:00 (2.29 MB/s) - 已保存 “rpm-4.11.3-25.el7.x86_64.rpm” [1216680/1216680]) [root@localhost jiayimeng]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm --2017-12-22 17:19:44-- http://mirrors.163.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm 正在解析主机 mirrors.163.com (mirrors.163.com)... 123.58.190.235, 123.58.190.234, 123.58.190.237, ... 正在连接 mirrors.163.com (mirrors.163.com)|123.58.190.235|:80... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:110540 (108K) [application/x-redhat-package-manager] 正在保存至: “python-urlgrabber-3.10-8.el7.noarch.rpm” 100%[====================>] 110,540 462KB/s 用时 0.2s 2017-12-22 17:19:44 (462 KB/s) - 已保存 “python-urlgrabber-3.10-8.el7.noarch.rpm” [110540/110540]) ----升级---- [root@localhost jiayimeng]# rpm -Uvh rpm-4.11.3-25.el7.x86_64.rpm --nodeps 警告:rpm-4.11.3-25.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY 准备中... ################################# [100%] 正在升级/安装... 1:rpm-4.11.3-25.el7 ################################# [ 50%] 正在清理/删除... 2:rpm-4.11.3-17.el7 ################################# [100%] [root@localhost jiayimeng]# rpm -Uvh python-urlgrabber-3.10-8.el7.noarch.rpm --nodeps 警告:python-urlgrabber-3.10-8.el7.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY 准备中... ################################# [100%] 正在升级/安装... 1:python-urlgrabber-3.10-8.el7 ################################# [ 50%] 正在清理/删除... 2:python-urlgrabber-3.10-7.el7 ################################# [100%] 7、更新yum源 [root@localhost jiayimeng]# rm /etc/yum.repos.d/redhat.repo rm:是否删除普通文件 "/etc/yum.repos.d/redhat.repo"?y [root@localhost jiayimeng]# vim /etc/yum.repos.d/CentOS-Base.repo #CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$7 - Base - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=os baseurl=http://mirrors.163.com/centos/7/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$7 - Updates - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=updates baseurl=http://mirrors.163.com/centos/7/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-$7 - Extras - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=extras baseurl=http://mirrors.163.com/centos/7/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$7 - Plus - 163.com baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 8、清除yum缓存 [root@localhost ~]# yum clean all 9、生成缓存 [root@localhost ~]# yum makecache 已加载插件:fastestmirror, product-id, search-disabled-repos, : subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. base | 3.6 kB 00:00 extras | 3.4 kB 00:00 updates | 3.4 kB 00:00 (1/12): base/x86_64/group_gz | 156 kB 00:00 (2/12): base/x86_64/filelists_db | 6.7 MB 00:02 (3/12): base/x86_64/primary_db | 5.7 MB 00:01 (4/12): base/x86_64/other_db | 2.5 MB 00:00 (5/12): extras/x86_64/prestodelta | 71 kB 00:00 (6/12): extras/x86_64/filelists_db | 528 kB 00:00 (7/12): extras/x86_64/other_db | 96 kB 00:00 (8/12): extras/x86_64/primary_db | 145 kB 00:00 (9/12): updates/x86_64/prestodelta | 605 kB 00:01 (10/12): updates/x86_64/filelists_db | 2.8 MB 00:01 (11/12): updates/x86_64/other_db | 492 kB 00:00 (12/12): updates/x86_64/primary_db | 4.6 MB 00:00 Determining fastest mirrors 元数据缓存已建立
二、踩坑
在第6步报错时,我在安装新版本的rpm包时,未使用-Uvh参数,而是使用-ivh参数附加--nodeps,这时安装失败,按照网上的方法,加上了--force参数,导致rpm包依赖出现问题报错为
/usr/lib64/python2
.7
/site-packages/rpm/_rpm
.so: 未定义符号: rpmpkgVerifySigs
这样的话,水平有限,只能重装解决。总结教训,rpm的强制忽略依赖关系参数易导致版本间出现问题。铭记!