1、查看本身系統的安裝包
rpm -qa | grep yum
2、卸載系統本身的yum
rpm -qa | grep yum | xargs rpm -e --nodeps #不檢查依賴關系,直接卸載
3、從網絡上下載yum安裝包,由於國內yum的多多少少有兼容問題,從國外下載了相關包
yum-utils-1.1.31-34.el7.noarch.rpm yum-updateonboot-1.1.31-34.el7.noarch.rpm yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm yum-3.4.3-132.el7.centos.0.1.noarch.rpm
4、相關安裝包百度網盤分享資料
鏈接:https://pan.baidu.com/s/1g3taaQDGqlWsRc7RrdcIGg 提取碼:1pja
5、將這些安裝包傳到linux系統的同一個目錄下,使用winscap軟件
鏈接:https://pan.baidu.com/s/13N8DZocShprzRKtrRCRKAQ 提取碼:s0pu
6、安裝所有包
rpm -ivh *
rpm -qa | grep yum # 查詢是否安裝好
7、安裝成功后,添加如下內容到/etc/yum.repos.d/xx.repo的文件下
[base] name= base baseurl=http://mirrors.aliyun.com/centos/7/os/$basearch/ enabled=1 gpgcheck=0
8、保存退出,使用yum makecache緩存
9、使用yum repolist all查看
[root@csm redhat7可用centos yum安裝包]# yum repolist all Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Loading mirror speeds from cached hostfile repo id repo name status base/x86_64 CentOS-$7 - Base - 163.com enabled: 10,097 centosplus/x86_64 CentOS-$7 - Plus - 163.com disabled extras/x86_64 CentOS-$7 - Extras - 163.com enabled: 335 updates/x86_64 CentOS-$7 - Updates - 163.com enabled: 1,774 repolist: 12,206
