欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Centos7卸载并重新安装yum源

程序员文章站 2022-05-31 08:12:32
...


在使用 yum install 命令时遇到如下问题:

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.

通过百度知悉,可以通过重新安装yum源来解决上述问题。

一、卸载现有的yum源

// 查看现有的yum源
[[email protected] ~]# rpm -qa yum | grep yum
yum-3.4.3-168.el7.centos.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-utils-1.1.31-54.el7_8.noarch
yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch
// 卸载:rpm –e 
// 强制:--nodeps
 [[email protected] ~]# rpm –qa | grep yum | xargs rpm –e --nodeps

二、下载yum源相关的rpm包

[[email protected] ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
[[email protected] ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-54.el7_8.noarch.rpm
[[email protected] ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
[[email protected] ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
// 查看下载好的rpm包
[[email protected] ~]# ls
yum-3.4.3-168.el7.centos.noarch.rpm          yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm  yum-utils-1.1.31-54.el7_8.noarch.rpm

三、重新安装yum源

// 强制安装,安装完成后即可正常使用
[[email protected] ~]# rpm -ivh yum-* --nodeps
Preparing...                          ################################# [100%]
Updating / installing...
   1:yum-metadata-parser-1.1.4-10.el7 ################################# [ 25%]
   2:yum-plugin-fastestmirror-1.1.31-5################################# [ 50%]
   3:yum-3.4.3-168.el7.centos         ################################# [ 75%]
   4:yum-utils-1.1.31-54.el7_8        ################################# [100%]
// 查看重新安装后的yum源
[[email protected] ~]# rpm -qa yum
yum-3.4.3-168.el7.centos.noarch