Centos7卸载yum并重装

发表于:2020-06-09 21:06:59      发布在:解疑答惑      评论:0 条评论

1.yum卸载

Centos7卸载yum并重装


  1. # rpm -qa yum


  2. # rpm -qa | grep yum | xargs rpm -e --nodeps 

  3. # rpm -qa yum


2.下载rpm包

centos 官方下载网站是 http://mirror.centos.org/centos/

去这里找包http://mirror.centos.org/centos/7.8.2003/os/x86_64/Packages/,没有合适的就去拿自己的网上搜一下下载地址。

下载如下包:

wget http://mirror.centos.org/centos/7.8.2003/os/x86_64/Packages/python-backports-1.0-8.el7.x86_64.rpm

wget http://mirror.centos.org/centos/7.8.2003/os/x86_64/Packages/python-pycurl-7.19.0-19.el7.x86_64.rpm 

wget http://mirror.centos.org/centos/7.8.2003/os/x86_64/Packages/python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm 

wget http://mirror.centos.org/centos/7.8.2003/os/x86_64/Packages/python-ipaddress-1.0.16-2.el7.noarch.rpm 


wget http://mirror.centos.org/centos/7.8.2003/os/x86_64/Packages/python-setuptools-0.9.8-7.el7.noarch.rpm 


wget http://mirror.centos.org/centos/7.8.2003/os/x86_64/Packages/python-urlgrabber-3.10-10.el7.noarch.rpm 


wget http://mirror.centos.org/centos/7.8.2003/os/x86_64/Packages/python-2.7.5-88.el7.x86_64.rpm 


wget http://mirror.centos.org/centos/7.8.2003/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm 


wget http://mirror.centos.org/centos/7.8.2003/os/x86_64/Packages/python-libs-2.7.5-88.el7.x86_64.rpm 


wget http://mirror.centos.org/centos/7.8.2003/os/x86_64/Packages/python-devel-2.7.5-88.el7.x86_64.rpm 


wget http://mirror.centos.org/centos/7.8.2003/os/x86_64/Packages/rpm-4.11.3-43.el7.x86_64.rpm  


wget http://mirror.centos.org/centos/7.8.2003/os/x86_64/Packages/yum-3.4.3-167.el7.centos.noarch.rpm 


wget http://mirror.centos.org/centos/7.8.2003/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm 


wget http://mirror.centos.org/centos/7.8.2003/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-53.el7.noarch.rpm

3.安装rpm包

先装python

运行 rpm 命令。[这里一定要加 --replacefiles --replacepkgs 参数, 因为需要覆盖一些老文件老包,不加的话会提示文件冲突或者包已经安装过了。]


rpm -ivh python-backports-1.0-8.el7.x86_64.rpm

rpm -ivh python-pycurl-7.19.0-19.el7.x86_64.rpm

rpm -ivh python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm 

rpm -ivh python-ipaddress-1.0.16-2.el7.noarch.rpm

rpm -ivh python-setuptools-0.9.8-7.el7.noarch.rpm

rpm -ivh python-urlgrabber-3.10-10.el7.noarch.rpm

rpm -ivh python-2.7.5-88.el7.x86_64.rpm 

rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm 

rpm -ivh python-libs-2.7.5-88.el7.x86_64.rpm 

rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm 

rpm -ivh python-libs-2.7.5-88.el7.x86_64.rpm 

rpm -ivh python-devel-2.7.5-88.el7.x86_64.rpm

rpm -ivh rpm-4.11.3-43.el7.x86_64.rpm  



再安装 yum,【同样也要加 --replacefiles --replacepkgs。】


rpm -ivh yum-3.4.3-167.el7.centos.noarch.rpm

rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm 

rpm -ivh yum-plugin-fastestmirror-1.1.31-53.el7.noarch.rpm

rpm -ivh yum-3.4.3-167.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-53.el7.noarch.rpm


这里一定要注意,必须出现进度条 100% 的 输出,才是安装成功了。

不同版本的系统,需要的包可能不太一样,当运行安装命令时,可能会提示有一些依赖包缺失。

这种情况下,可以根据提示下载响应的依赖包,添加到 rpm -ivh 的列表中。


4.安装完成

尝试运行下 yum。

【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】

centos常用漏洞升级修复命令



yum update kernel
yum update kernel-devel
yum update kernel-firmware
yum update kernel-headers
yum update nss-util
yum update nss
yum update nss-sysinit
yum update nss-tools
yum update vim-minimal
yum update openssh
yum update openssh-clients
yum update openssh-server
yum update python
yum update python-libs

升级系统内核:yum -y upgrade
升级所有包,改变软件设置和系统设置,系统版本内核都升级:yum -y update

升级所有包,不改变软件设置和系统设置,系统版本升级,内核不改变:yum -y upgrade


下一篇:人生之妥协
评论
你好,访客
召唤伊斯特瓦尔