centos系统 重新安装yum


1,查看centos系统本身所安装的那些yum 软件包:rpm -qa|grep yum
卸载这些软件包:rpm -e +以上命令查询出的包
2,查看系统的命令:cat /etc/redhat-release
3,下载对应版本yum包
wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
wget http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
4,安装下载的这些yum包:rpm -ivh yum-*(可能出错,出错则单个安装,如下所示:)

安装命令:rpm -ivh 包
安装包相互有依赖,安装时需要注意顺序:
(1)、安装python-iniparse
(2)、安装yum-metadata-parser
(3)、yum和yum-plugin-fastestmirror一起安装
(两个包一起装,不然会报错,因为他们之间存在依赖关系)
rpm -ivh yum-3.4.3-168.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm

5,更新centos系统的repo文件:http://mirrors.163.com/.help/centos.html
6, 重新运用yum安装软件
7,生成缓存命令:yum makecache
8,yum clean all
更新yum文件:yum update
检查是否安装:yum install perl-DBI

posted @ 2021-05-11 17:16  小良哥  阅读(9914)  评论(0编辑  收藏  举报