redhat 7.2更新yum源时踩的坑

简介:

一、update yum

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
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:http: //mirrors .163.com/
aliyun: http: //mirrors .aliyun.com/
中科大:http: //mirrors .ustc.edu.cn/
 
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%]
[root@localhost jiayimeng] # rpm -ivh yum*
警告:yum-3.4.3-154.el7.centos.noarch.rpm: 头V3 RSA /SHA256  Signature, 密钥 ID f4a80eb5: NOKEY
准备中...                           ################################# [100%]
正在升级/安装...
    1:yum-metadata-parser-1.1.4-10.el7  ################################# [ 20%]
    2:yum-plugin-fastestmirror-1.1.31-4 ################################# [ 40%]
    3:yum-3.4.3-154.el7.centos          ################################# [ 60%]
    4:yum-updateonboot-1.1.31-42.el7    ################################# [ 80%]
    5:yum-utils-1.1.31-42.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包依赖出现问题报错为

1
/usr/lib64/python2 .7 /site-packages/rpm/_rpm .so: 未定义符号: rpmpkgVerifySigs

    这样的话,水平有限,只能重装解决。总结教训,rpm的强制忽略依赖关系参数易导致版本间出现问题。铭记!



本文转自 元婴期 51CTO博客,原文链接:http://blog.51cto.com/jiayimeng/2053694

相关文章
|
缓存 开发工具
RedHat8.4配置本地yum软件仓库(RHEL8.4)
RedHat8.4配置本地yum软件仓库(RHEL8.4)
1248 0
RedHat8.4配置本地yum软件仓库(RHEL8.4)
|
Linux
Centos/Redhat 本地yum源配置(Linux)
Centos/Redhat 本地yum源配置(Linux)
264 0
Centos/Redhat 本地yum源配置(Linux)
|
关系型数据库 MySQL Linux
RedHat7.4 Yum环境下搭建LAMP实现库站分离(部署wordpress博客)
RedHat7.4 Yum环境下搭建LAMP实现库站分离(部署wordpress博客)
170 0
RedHat7.4 Yum环境下搭建LAMP实现库站分离(部署wordpress博客)
|
缓存 Linux 开发工具
RedHat7.4配置yum软件仓库(RHEL7.4)
RedHat7.4配置yum软件仓库(RHEL7.4)
584 0
RedHat7.4配置yum软件仓库(RHEL7.4)
|
Linux
配置yum软件仓库(redhat 7.0)
第一步:切换到yum配置文件目录 执行:cd /etc/yum.repos.d/ 第二步:创建文件并进行编辑:vi rhel7.repo 写入如下内容:[rhel7] name=rhel7 ##名字随便命名 baseurl=file:///media/cdrom enabled=1 gpgch...
1200 0

推荐镜像

更多