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