卸载yum,重装yum
系统版本:
[root@CenOS8 rpm]# cat /etc/redhat-release
CentOS Linux release 8.2.2004 (Core)
1、卸载yum
1 2 3 |
|
2、验证是否删除干净:
1 |
|
3、下载两个对应系统版本下的rpm:yum-4.2.17-7.el8_2.noarch.rpm 、centos-repos-8.2-2.2004.0.2.el8.x86_64.rpm ,
下载地址:https://vault.centos.org/ ,下不下来就本地rz上传:
wget https://vault.centos.org/8.2.2004/BaseOS/x86_64/os/Packages/yum-4.2.17-7.el8_2.noarch.rpm
wget https://vault.centos.org/8.2.2004/BaseOS/x86_64/os/Packages/centos-repos-8.2-2.2004.0.2.el8.x86_64.rpm
4、安装:
rpm -ivh yum-4.2.17-7.el8_2.noarch.rpm
rpm -ivh centos-repos-8.2-2.2004.0.2.el8.x86_64.rpm
5、检查是否可以了:
yum repolist
yum update
上边亲测:
===========================================================================================
下边CV:
Linux 系统为 CentOS Linux release 7.4.1708
重装yum和python
- 首先卸载现有python
-
rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps #卸载python
-
whereis python |xargs rm -frv ##删除所有残余文件
-
whereis python ##验证删除,返回无结果
-
- 删除现有的yum
-
rpm -qa|grep yum|xargs rpm -ev --allmatches --nodeps #删除yum
-
whereis yum |xargs rm -frv #删除残留文件
-
whereis yum #验证删除完成
-
-
找到下载文件源
首先在这里找到服务器对应的版本,如 7.4.1708 进入这里目录 找到对应版本的rpm,替换下面的文件。 -
下载并安装,注意顺序,先安装python 然后 yum。不然安装后还会报错,重新来一遍。
-
# python安装
-
rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-2.7.5-58.el7.x86_64.rpm
-
rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-devel-2.7.5-58.el7.x86_64.rpm
-
rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
-
rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-libs-2.7.5-58.el7.x86_64.rpm
-
rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-pycurl-7.19.0-19.el7.x86_64.rpm
-
rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm
-
rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/rpm-python-4.11.3-25.el7.x86_64.rpm
-
-
# yum安装
-
rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/yum-3.4.3-154.el7.centos.noarch.rpm
-
rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
-
rpm -ivh --nodeps http://vault.centos.org/7.4.1708/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-42.el7.noarch.rpm
-
-
验证
-
#验证python
-
python
-
#验证yum
-
yum
-