1、update yumnode
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 元數據緩存已創建
2、踩坑python
在第6步報錯時,我在安裝新版本的rpm包時,未使用-Uvh參數,而是使用-ivh參數附加--nodeps,這時安裝失敗,按照網上的方法,加上了--force參數,致使rpm包依賴出現問題報錯爲vim
/usr/lib64/python2
.7
/site-packages/rpm/_rpm
.so: 未定義符號: rpmpkgVerifySigs