一、首先查看redhat 7.0系統自己所安裝的那些yum 軟件包:node
[root@linuxprobe ~]# rpm -qa | grep yum yum-utils-1.1.31-24.el7.noarch yum-langpacks-0.4.2-3.el7.noarch yum-metadata-parser-1.1.4-10.el7.x86_64 yum-rhn-plugin-2.0.1-4.el7.noarch PackageKit-yum-0.8.9-11.el7.x86_64 yum-3.4.3-118.el7.noarch
二、卸載這些軟件包;python
[root@linuxprobe ~]# rpm -e yum-3.4.3-118.el7.noarch --nodeps [root@linuxprobe ~]# rpm -e yum-utils-1.1.31-24.el7.noarch --nodeps [root@linuxprobe ~]# rpm -e yum-rhn-plugin-2.0.1-4.el7.noarch --nodeps [root@linuxprobe ~]# rpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 --nodeps [root@linuxprobe ~]# rpm -e yum-langpacks-0.4.2-3.el7.noarch --nodeps [root@linuxprobe ~]# rpm -e PackageKit-yum-0.8.9-11.el7.x86_64 --nodeps
三、保證本機電腦能上網;linux
[root@linuxprobe ~]# ping www.baidu.co PING www.a.shifen.com (61.135.169.121) 56(84) bytes of data. 64 bytes from 61.135.169.121: icmp_seq=1 ttl=53 time=31.8 ms 64 bytes from 61.135.169.121: icmp_seq=2 ttl=53 time=31.9 ms 64 bytes from 61.135.169.121: icmp_seq=3 ttl=53 time=32.0 ms
四、進入如下網站上面查看軟件包的版本是否升級或者找到本身系統所對應的文件包版本更新;git
網易163網絡源地址:http://mirrors.163.com/ CentOS網絡源地址:http://centos.ustc.edu.cn/centos/
五、找到本身所須要的版本下載:vim
[root@Linuxprobe ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-118.el7.centos.noarch.rpm --2016-01-17 20:43:15-- http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-118.el7.centos.noarch.rpm Resolving mirrors.163.com (mirrors.163.com)... 123.58.173.185, 123.58.173.186 Connecting to mirrors.163.com (mirrors.163.com)|123.58.173.185|:80... connected. HTTP request sent, awaiting response... 404 Not Found 2016-01-17 20:43:15 ERROR 404: Not Found. //若是找不到,是安裝包更新了,你能夠到這個網站http://mirrors.163.com/centos/7/os/x86_64/Packages/複製下載連接,而後再下載下來; 已更新到 wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-161.el7.centos.noarch.rpm [root@linuxprobe ~]# [root@linuxprobe ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm [root@linuxprobe ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-50.el7.noarch.rpm [root@linuxprobe ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-50.el7.noarch.rpm [root@linuxprobe ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm
六、查看下載完成結果;centos
[root@linuxprobe ~]# ls 3.安裝軟件包。 rpm -ivh python-iniparse-0.3.1-2.1.el7.noarch.rpm rpm -ivh python-urlgrabber-3.9.1-11.el7.noarch.rpm rpm -ivh yum-metadata-parser-1.1.2-17.el7.x87_74.rpm rpm -ivh yum-plugin-fastestmirror-1.1.30-37.el7.noarch.rpm yum-3.2.29-73.el7.centos.noarch.rpm *註釋yum-plugin-fastestmirror和yum-3.2.29要一塊兒安裝。
七、安裝軟件包:緩存
[root@Linuxprobe ~]# rpm -ivh yum-3.4.3-161.el7.centos.noarch.rpm
安裝 yum-3.4.3-161.el7.centos.noarch.rpm 必須先安裝 python-urlgrabber (版本>=3.10-8) | rpm(版本>=4.11.3-22) | yum-plugin-fastestmirror(對版本無要求) 這三個。網絡
若是按照遇到問題:發現錯誤,python-urlgrabber版本必須大於等於3.9.1-10
# rpm -ivh yum-3.2.29-73.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-37.el7.noarch.rpm
warning: yum-3.2.29-73.el7.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
error: Failed dependencies:
python-urlgrabber >= 3.9.1-10 is needed by yum-3.2.29-73.el7.centos.noarch
查看系統的python信息
# rpm -qa|grep python架構
我找到本身的版本app
rpm -e python-urlgrabber-3.10-4.el7.noarch --nodeps
安裝7的軟件包 wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-9.el7.noarch.rpm
發現python-urlgrabber-3.9.1-9.el7.noarch 版本低於3.9.1-10
卸載:python-urlgrabber-3.9.1-9.el7.noarch
rpm -e python-urlgrabber-3.9.1-9.el7.noarch
安裝:rpm -ivh python-urlgrabber-3.9.1-11.el7.noarch.rpm
---------------------
做者:zhaosenoo
來源:CSDN
原文:https://blog.csdn.net/zhaosenoo/article/details/70919881
版權聲明:本文爲博主原創文章,轉載請附上博文連接!
那麼咱們就按照提示來作吧,如今安裝 python-urlgrabber-3.10-9.el7.noarch.rpm (別忘了先去下載安裝包)
[root@localhost home]# rpm -ivh python-urlgrabber-3.10-9.el7.noarch.rpm
警告:python-urlgrabber-3.10-9.el7.noarch.rpm: 頭V3 RSA/SHA256 Signature, 密鑰 ID f4a80eb5: NOKEY
準備中... ################################# [100%]
正在升級/安裝...
1:python-urlgrabber-3.10-9.el7 ################################# [100%]
1
2
3
4
5
6
如今咱們再安裝 yum-3.4.3-161.el7.centos.noarch.rpm
[root@localhost home]# rpm -ivh yum-3.4.3-161.el7.centos.noarch.rpm
警告:yum-3.4.3-161.el7.centos.noarch.rpm: 頭V3 RSA/SHA256 Signature, 密鑰 ID f4a80eb5: NOKEY
錯誤:依賴檢測失敗:
rpm >= 0:4.11.3-22 被 yum-3.4.3-161.el7.centos.noarch 須要
yum-plugin-fastestmirror 被 yum-3.4.3-161.el7.centos.noarch 須要
1
2
3
4
5
6
發現 python-urlgrabber 已經安裝成功,再也不報須要 python-urlgrabber
四、安裝rpm(版本>=4.11.3-22)
首先咱們現有的 rpm
[root@localhost home]# rpm -qa | grep rpm
rpm-libs-4.11.1-16.el7.x86_64
rpm-python-4.11.1-16.el7.x86_64
rpm-4.11.1-16.el7.x86_64
rpm-build-libs-4.11.1-16.el7.x86_64
1
2
3
4
5
6
發現 rpm 已經有了 rpm-4.11.1-16.el7.x86_64 版本,可是不知足 rpm(版本>=4.11.3-22) 的要求。
[root@localhost home]# rpm -ivh rpm-4.11.3-35.el7.x86_64.rpm
警告:rpm-4.11.3-35.el7.x86_64.rpm: 頭V3 RSA/SHA256 Signature, 密鑰 ID f4a80eb5: NOKEY
準備中... ################################# [100%]
file /bin/rpm from install of rpm-4.11.3-35.el7.x86_64 conflicts with file from package rpm-4.11.1-16.el7.x86_64
file /usr/bin/rpm2cpio from install of rpm-4.11.3-35.el7.x86_64 conflicts with file from package rpm-4.11.1-16.el7.x86_64
file /usr/bin/rpmdb from install of rpm-4.11.3-35.el7.x86_64 conflicts with file from package rpm-4.11.1-16.el7.x86_64
file /usr/bin/rpmkeys from install of rpm-4.11.3-35.el7.x86_64 conflicts with file from package rpm-4.11.1-16.el7.x86_64
file /usr/lib/rpm/macros from install of rpm-4.11.3-35.el7.x86_64 conflicts with file from package rpm-4.11.1-16.el7.x86_64
file /usr/lib/rpm/platform/aarch64-linux/macros from install of rpm-4.11.3-35.el7.x86_64 conflicts with file from package rpm-4.11.1-16.el7.x86_64
...... 自處省略
1
2
3
4
5
6
7
8
9
10
11
[root@localhost home]# rpm -ivh yum-3.4.3-161.el7.centos.noarch.rpm
警告:yum-3.4.3-161.el7.centos.noarch.rpm: 頭V3 RSA/SHA256 Signature, 密鑰 ID f4a80eb5: NOKEY
錯誤:依賴檢測失敗:
rpm >= 0:4.11.3-22 被 yum-3.4.3-161.el7.centos.noarch 須要
yum-plugin-fastestmirror 被 yum-3.4.3-161.el7.centos.noarch 須要
1
2
3
4
5
6
如今咱們再安裝 yum-3.4.3-161.el7.centos.noarch.rpm
[root@localhost home]# rpm -ivh yum-3.4.3-161.el7.centos.noarch.rpm
警告:yum-3.4.3-161.el7.centos.noarch.rpm: 頭V3 RSA/SHA256 Signature, 密鑰 ID f4a80eb5: NOKEY
錯誤:依賴檢測失敗:
rpm >= 0:4.11.3-22 被 yum-3.4.3-161.el7.centos.noarch 須要
yum-plugin-fastestmirror 被 yum-3.4.3-161.el7.centos.noarch 須要
1
2
3
4
5
6
第一個坑:發現仍是報 rpm >= 0:4.11.3-22 被 yum-3.4.3-161.el7.centos.noarch 須要
搜了一些資料發現是咱們的命令寫錯了:
以前咱們已經有了 rpm-4.11.1-16.el7.x86_64 版本,因此咱們要升級 rpm 便可,命令這樣寫:
[root@localhost home]# rpm -Uvh rpm-4.11.3-35.el7.x86_64.rpm --nodeps
警告:rpm-4.11.3-35.el7.x86_64.rpm: 頭V3 RSA/SHA256 Signature, 密鑰 ID f4a80eb5: NOKEY
準備中... ################################# [100%]
正在升級/安裝...
1:rpm-4.11.3-35.el7 ################################# [ 50%]
正在清理/刪除...
2:rpm-4.11.1-16.el7 ################################# [100%]
1
2
3
4
5
6
7
8
就是把
[root@localhost home]# rpm -ivh yum-3.4.3-161.el7.centos.noarch.rpm
1
改成
[root@localhost home]# rpm -Uvh rpm-4.11.3-35.el7.x86_64.rpm --nodeps
1
如今咱們再安裝 yum-3.4.3-161.el7.centos.noarch.rpm 發現只須要安裝 yum-plugin-fastestmirror 就能夠了
[root@localhost home]# rpm -ivh yum-3.4.3-161.el7.centos.noarch.rpm
警告:yum-3.4.3-161.el7.centos.noarch.rpm: 頭V3 RSA/SHA256 Signature, 密鑰 ID f4a80eb5: NOKEY
錯誤:依賴檢測失敗:
yum-plugin-fastestmirror 被 yum-3.4.3-161.el7.centos.noarch 須要
1
2
3
4
5
五、安裝yum-plugin-fastestmirror
[root@localhost home]# rpm -ivh yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm
警告:yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm: 頭V3 RSA/SHA256 Signature, 密鑰 ID f4a80eb5: NOKEY
錯誤:依賴檢測失敗:
yum >= 3.0 被 yum-plugin-fastestmirror-1.1.31-50.el7.noarch 須要
1
2
3
4
5
第二個坑:蛋疼的事情出現了安裝 yum-plugin-fastestmirror 依賴 yum(版本>=3.0),安裝yum-3.4.3-161又依賴yum-plugin-fastestmirror。互相依賴了怎麼搞?
這段蛋疼的互相須要
[root@localhost home]# rpm -ivh yum-3.4.3-161.el7.centos.noarch.rpm
警告:yum-3.4.3-161.el7.centos.noarch.rpm: 頭V3 RSA/SHA256 Signature, 密鑰 ID f4a80eb5: NOKEY
錯誤:依賴檢測失敗:
yum-plugin-fastestmirror 被 yum-3.4.3-161.el7.centos.noarch 須要
[root@localhost home]# rpm -ivh yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm
警告:yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm: 頭V3 RSA/SHA256
Signature, 密鑰 ID f4a80eb5: NOKEY 錯誤:依賴檢測失敗:
yum >= 3.0 被 yum-plugin-fastestmirror-1.1.31-50.el7.noarch 須要
解決辦法:
不怎麼搞,那就一塊兒安裝唄。
[root@localhost home]# rpm -ivh yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm yum-3.4.3-161.el7.centos.noarch.rpm
警告:yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm: 頭V3 RSA/SHA256 Signature, 密鑰 ID f4a80eb5: NOKEY
準備中... ################################# [100%]
正在升級/安裝...
1:yum-3.4.3-161.el7.centos ################################# [ 50%]
2:yum-plugin-fastestmirror-1.1.31-5################################# [100%]
1
2
3
4
5
6
7
搞定了。
六、安裝yum-updateonboot和yum-utils
[root@localhost home]# rpm -ivh yum-updateonboot-1.1.31-50.el7.noarch.rpm
警告:yum-updateonboot-1.1.31-50.el7.noarch.rpm: 頭V3 RSA/SHA256 Signature, 密鑰 ID f4a80eb5: NOKEY
準備中... ################################# [100%]
正在升級/安裝...
1:yum-updateonboot-1.1.31-50.el7 ################################# [100%]
[root@localhost home]# rpm -ivh yum-utils-1.1.31-50.el7.noarch.rpm
警告:yum-utils-1.1.31-50.el7.noarch.rpm: 頭V3 RSA/SHA256 Signature, 密鑰 ID f4a80eb5: NOKEY
準備中... ################################# [100%]
---------------------
3、配置yum源
在阿里雲開源軟件鏡像站點下載資源文件 http://mirrors.aliyun.com/repo/Centos-7.repo添加連接描述
把下載的文件放在 /etc/yum.repos.d/ 文件夾下面並重命名爲 CentOS-Base.repo
編輯 CentOS-Base.repo
把文件中全部的 $releasever替換爲 7。注意,是全部的 $releasever 替換爲7
運行如下命令生成緩存
yum clean all
yum makecache
1
2
若出現:
/var/run/yum.pid 已被鎖定,PID 爲 2703 的另外一個程序正在運行。
Another app is currently holding the yum lock; waiting for it to exit...
另外一個應用程序是:yum
內存: 28 M RSS (980 MB VSZ)
已啓動: Fri Dec 21 06:11:05 2018 - 07:18以前
狀態 :跟蹤/中止,進程ID:2703
Another app is currently holding the yum lock; waiting for it to exit...
1
2
3
4
5
6
7
則執行一次:
rm -f /var/run/yum.pid
1
測試
[root@localhost home]# yum install net-tools
已加載插件:fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解決依賴關係
--> 正在檢查事務
---> 軟件包 net-tools.x86_64.0.2.0-0.24.20131004git.el7 將被 安裝
--> 解決依賴關係完成
依賴關係解決
=========================================================================================================================================================================================================================================
Package 架構 版本 源 大小
=========================================================================================================================================================================================================================================
正在安裝:
net-tools x86_64 2.0-0.24.20131004git.el7 base 306 k
事務概要
=========================================================================================================================================================================================================================================
安裝 1 軟件包
總下載量:306 k
安裝大小:918 k
---------------------
做者:子非魚yy
來源:CSDN
原文:https://blog.csdn.net/ztx114/article/details/85149629
八、新建repo 配置文件;
[root@linuxprobe ~]# 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
九、至此YUM 網絡源已經安裝完成;
[root@linuxprobe ~]# yum clean all
十、測試安裝是否正常;
[root@Linuxprobe ~]# yum -y install lftp Loaded plugins: fastestmirror, product-id, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Loading mirror speeds from cached hostfile Resolving Dependencies --> Running transaction check ---> Package lftp.x86_64 0:4.4.8-7.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================================ Package Arch Version Repository Size ================================================================================================ Installing: lftp x86_64 4.4.8-7.el7 base 750 k Transaction Summary ================================================================================================ Install 1 Package ………………省略部分安裝過程……………… Installed: lftp.x86_64 0:4.4.8-7.el7 Complete!
到這裏安裝完成,之後安裝所需包,能夠不用本地yum源了,直接使用網絡yum源。