zoukankan      html  css  js  c++  java
  • CentOS7的yum重装

    前言

     腾讯云服务器上的本机python环境被我不小心卸载了,而yum依赖python环境,当我重新安装同版本的python环境后,做了如下操作,没有解决yum不能使用的问题(no module named yum):

    复制代码
    whereis yum 
    
    whereis python
    
    sudo rm -rf /usr/bin/python 
    
    sudo ln -s /usr/bin/python2.6/bin/python /usr/bin/python
    复制代码

    整个重新安装过程

    1、删除现有的python

    rpm -qa|grep python|xargs rpm -ev –allmatches –nodeps ##强制清除已安装的程序及其关联

    whereis python |xargs rm -frv ##删除所有残余文件 ##xargs,允许你对输出执行其他某些命令

    whereis python ##验证删除,返回无结果说明清除干净

    2、删除现有的yum

    rpm -qa|grep yum|xargs rpm -ev –allmatches –nodeps

    whereis yum |xargs rm -frv

    3、检查CentOS 7版本
    cat /etc/centos-release

    4、找到对应的依赖下载
    http://vault.centos.org/
    http://mirrors.163.com/

    • python-2.7.5-34.el7.x86_64.rpm
    • python-iniparse-0.4-9.el7.noarch.rpm
    • python-libs-2.7.5-34.el7.x86_64.rpm
    • python-pycurl-7.19.0-17.el7.x86_64.rpm
    • python-urlgrabber-3.10-7.el7.noarch.rpm
    • rpm-python-4.11.3-17.el7.x86_64.rpm
    • yum-3.4.3-132.el7.centos.0.1.noarch.rpm
    • yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
    • yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
    复制代码
    wget https://vault.centos.org/7.2.1511/os/x86_64/Packages/python-2.7.5-34.el7.x86_64.rpm
    wget https://vault.centos.org/7.2.1511/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
    wget https://vault.centos.org/7.2.1511/os/x86_64/Packages/python-pycurl-7.19.0-17.el7.x86_64.rpm
    wget https://vault.centos.org/7.2.1511/os/x86_64/Packages/python-urlgrabber-3.10-7.el7.noarch.rpm
    wget https://vault.centos.org/7.2.1511/os/x86_64/Packages/rpm-python-4.11.3-17.el7.x86_64.rpm
    wget https://vault.centos.org/7.2.1511/os/x86_64/Packages/python-libs-2.7.5-34.el7.x86_64.rpm
    wget https://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-3.4.3-132.el7.centos.0.1.noarch.rpm
    wget https://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
    wget https://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
    复制代码

    5、安装

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

    6、验证

  • 相关阅读:
    强行删除带点的文件夹
    如何设置让iis服务器支持.apk文件的下载
    纯CSS下拉导航菜单
    <UL>中<li>标签前编号图片的简单调用
    滑动门效果【鼠标滑过鼠标单击两种】
    SQL Server中,NumricDecimalMoney三种字段类型的区别
    SQL Server 20个最常用的时间格式
    Gridview------Set BackgroundColor
    c# 中is 和 as 运算符
    SQL LEFT JOIN 关键字 SQL RIGHT JOIN 关键字 fulljoin
  • 原文地址:https://www.cnblogs.com/Su-per-man/p/14926019.html
Copyright © 2011-2022 走看看