CentOS 7.x安装重装、卸载yum命令

  • Post author:
  • Post category:其他


按照以下步骤操作,100%成功,亲测



1、卸载系统存在的Python

	rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps
	whereis python |xargs rm -frv



2、卸载系统存在的yum

	rpm -qa|grep yum|xargs rpm -ev --allmatches --nodeps
	whereis yum |xargs rm -frv



3、查询当前的linux系统版本

	cat /etc/redhat-release
	例子(执行结果):CentOS Linux release 7.5.1804 (Core)



4、下载系统版本对应的yum相关依赖



4.1 CentOS7.4.1708

注意:以下命令中的7.4.1708代表的是当前的系统版本(CentOS Linux release 7.4.1708 (Core)),需要替换成你自己系统的版本(参考上文第3步),

	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/libxml2-2.9.1-6.el7_2.3.x86_64.rpm
	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/libxml2-python-2.9.1-6.el7_2.3.x86_64.rpm
	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-2.7.5-58.el7.x86_64.rpm
	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-backports-1.0-8.el7.x86_64.rpm
	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-backports-ssl_match_hostname-3.4.0.2-4.el7.noarch.rpm
	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-chardet-2.2.1-1.el7_1.noarch.rpm
	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-devel-2.7.5-58.el7.x86_64.rpm
	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-ipaddress-1.0.16-2.el7.noarch.rpm
	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-kitchen-1.1.1-5.el7.noarch.rpm
	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-libs-2.7.5-58.el7.x86_64.rpm
	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-pycurl-7.19.0-19.el7.x86_64.rpm
	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-setuptools-0.9.8-7.el7.noarch.rpm
	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm
	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-virtualenv-1.10.1-4.el7.noarch.rpm
	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/rpm-4.11.3-25.el7.x86_64.rpm
	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/rpm-build-4.11.3-25.el7.x86_64.rpm
	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/rpm-build-libs-4.11.3-25.el7.x86_64.rpm
	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/rpm-libs-4.11.3-25.el7.x86_64.rpm
	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/rpm-python-4.11.3-25.el7.x86_64.rpm
	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/rpm-sign-4.11.3-25.el7.x86_64.rpm
	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/yum-3.4.3-154.el7.centos.noarch.rpm
	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/yum-plugin-aliases-1.1.31-42.el7.noarch.rpm
	wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/yum-utils-1.1.31-42.el7.noarch.rpm



4.2 CentOS7.5.1804

	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/libxml2-2.9.1-6.el7_2.3.x86_64.rpm
	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/libxml2-python-2.9.1-6.el7_2.3.x86_64.rpm
	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-2.7.5-68.el7.x86_64.rpm
	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-backports-1.0-8.el7.x86_64.rpm
	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm
	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-chardet-2.2.1-1.el7_1.noarch.rpm
	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-devel-2.7.5-68.el7.x86_64.rpm
	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-ipaddress-1.0.16-2.el7.noarch.rpm
	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-kitchen-1.1.1-5.el7.noarch.rpm
	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-libs-2.7.5-68.el7.x86_64.rpm
	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-pycurl-7.19.0-19.el7.x86_64.rpm
	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-setuptools-0.9.8-7.el7.noarch.rpm
	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm
	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-virtualenv-15.1.0-2.el7.noarch.rpm
	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/rpm-4.11.3-32.el7.x86_64.rpm
	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/rpm-build-4.11.3-32.el7.x86_64.rpm
	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/rpm-build-libs-4.11.3-32.el7.x86_64.rpm
	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/rpm-libs-4.11.3-32.el7.x86_64.rpm
	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/rpm-python-4.11.3-32.el7.x86_64.rpm
	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/rpm-sign-4.11.3-32.el7.x86_64.rpm
	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm
	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-plugin-aliases-1.1.31-45.el7.noarch.rpm
	wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-utils-1.1.31-45.el7.noarch.rpm



5、安装yum命令包

	rpm -Uvh --replacepkgs *.rpm --nodeps --force



是否安装成功

·· yum



7、切换阿里云镜像仓库

	mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
	wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo



8、更新yum缓存

	yum makecache



版权声明:本文为u013106291原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。