linux系统重装yum工具与python环境

文章目录

  • 前言
  • 一、强制删除原有环境
    • 1.删除python
    • 2.删除yum
  • 二、安装新环境前置准备
  • 三、下载依赖命令
    • 1.内核版本7.6.1810
      • 下载python依赖包
      • 下载yum包
    • 2.内核版本7.4.1708
      • 下载python依赖包
      • 下载yum包
    • 3.内核版本7.8.2003
      • 下载python依赖包
      • 下载yum依赖包
    • 4.下载结果
  • 四、安装

前言

安装之前需要卸载自己系统的环境,下面是两个强制删除命令

一、强制删除原有环境

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	## 删除所有相关文件
whereis yum ## 验证删除,返回无结果

二、安装新环境前置准备

在下载的时候需要根据路径名改成自己需要的系统名,与软件名

查看系统内核版本

cat /etc/redhat-release

查看系统位数

getconf LONG_BIT

linux系统重装yum工具与python环境_第1张图片

目标网站(可先在windows上浏览器打开查看我们用到的包所处的路径)

http://vault.centos.org/

示例:

我的Centos版本是7.6.1810,要用到包在以下网址下面

https://vault.centos.org/7.6.1810/os/x86_64/Packages/
linux系统重装yum工具与python环境_第2张图片

三、下载依赖命令

在下载依赖包之前可以创建需要先创建以下存放包的路径

mkdir /usr/local/src/python
mkdir /usr/local/src/yum

然后到指定的路径下载指定的依赖包,到指定的路径下执行相应的安装命令

1.内核版本7.6.1810

下载python依赖包

wget https://vault.centos.org/7.6.1810/os/x86_64/Packages/python-2.7.5-76.el7.x86_64.rpm
wget https://vault.centos.org/7.6.1810/os/x86_64/Packages/python-devel-2.7.5-76.el7.x86_64.rpm
wget https://vault.centos.org/7.6.1810/os/x86_64/Packages/python-libs-2.7.5-76.el7.x86_64.rpm
wget https://vault.centos.org/7.6.1810/os/x86_64/Packages/python-pycurl-7.19.0-19.el7.x86_64.rpm
wget https://vault.centos.org/7.6.1810/os/x86_64/Packages/python-setuptools-0.9.8-7.el7.noarch.rpm
wget https://vault.centos.org/7.6.1810/os/x86_64/Packages/python-urlgrabber-3.10-9.el7.noarch.rpm
wget https://vault.centos.org/7.6.1810/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
wget https://vault.centos.org/7.6.1810/os/x86_64/Packages/rpm-python-4.11.3-35.el7.x86_64.rpm

下载yum包

wget https://vault.centos.org/7.6.1810/os/x86_64/Packages/yum-3.4.3-161.el7.centos.noarch.rpm
wget https://vault.centos.org/7.6.1810/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget https://vault.centos.org/7.6.1810/os/x86_64/Packages/yum-utils-1.1.31-50.el7.noarch.rpm
wget https://vault.centos.org/7.6.1810/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm
wget https://vault.centos.org/7.6.1810/os/x86_64/Packages/yum-plugin-protectbase-1.1.31-50.el7.noarch.rpm
wget https://vault.centos.org/7.6.1810/os/x86_64/Packages/yum-plugin-aliases-1.1.31-50.el7.noarch.rpm

2.内核版本7.4.1708

下载python依赖包

wget https://vault.centos.org/7.4.1708/os/x86_64/Packages/python-2.7.5-58.el7.x86_64.rpm
wget https://vault.centos.org/7.4.1708/os/x86_64/Packages/python-devel-2.7.5-58.el7.x86_64.rpm
wget https://vault.centos.org/7.4.1708/os/x86_64/Packages/python-libs-2.7.5-58.el7.x86_64.rpm
wget https://vault.centos.org/7.4.1708/os/x86_64/Packages/python-pycurl-7.19.0-19.el7.x86_64.rpm
wget https://vault.centos.org/7.4.1708/os/x86_64/Packages/python-setuptools-0.9.8-7.el7.noarch.rpm
wget https://vault.centos.org/7.4.1708/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm
wget https://vault.centos.org/7.4.1708/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
wget https://vault.centos.org/7.4.1708/os/x86_64/Packages/rpm-python-4.11.3-25.el7.x86_64.rpm

下载yum包

wget https://vault.centos.org/7.4.1708/os/x86_64/Packages/yum-3.4.3-154.el7.centos.noarch.rpm
wget https://vault.centos.org/7.4.1708/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget https://vault.centos.org/7.4.1708/os/x86_64/Packages/yum-utils-1.1.31-42.el7.noarch.rpm
wget https://vault.centos.org/7.4.1708/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-42.el7.noarch.rpm
wget https://vault.centos.org/7.4.1708/os/x86_64/Packages/yum-plugin-protectbase-1.1.31-42.el7.noarch.rpm
wget https://vault.centos.org/7.4.1708/os/x86_64/Packages/yum-plugin-aliases-1.1.31-42.el7.noarch.rpm

3.内核版本7.8.2003

下载python依赖包

wget http://vault.centos.org/7.8.2003/os/x86_64/Packages/yum-3.4.3-167.el7.centos.noarch.rpm
wget http://vault.centos.org/7.8.2003/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://vault.centos.org/7.8.2003/os/x86_64/Packages/yum-utils-1.1.31-53.el7.noarch.rpm
wget http://vault.centos.org/7.8.2003/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-53.el7.noarch.rpm
wget http://vault.centos.org/7.8.2003/os/x86_64/Packages/yum-plugin-protectbase-1.1.31-53.el7.noarch.rpm
wget http://vault.centos.org/7.8.2003/os/x86_64/Packages/yum-plugin-aliases-1.1.31-53.el7.noarch.rpm

下载yum依赖包

wget http://vault.centos.org/7.8.2003/os/x86_64/Packages/python-2.7.5-88.el7.x86_64.rpm
wget http://vault.centos.org/7.8.2003/os/x86_64/Packages/python-devel-2.7.5-88.el7.x86_64.rpm
wget http://vault.centos.org/7.8.2003/os/x86_64/Packages/python-libs-2.7.5-88.el7.x86_64.rpm
wget http://vault.centos.org/7.8.2003/os/x86_64/Packages/python-pycurl-7.19.0-19.el7.x86_64.rpm
wget http://vault.centos.org/7.8.2003/os/x86_64/Packages/python-setuptools-0.9.8-7.el7.noarch.rpm
wget http://vault.centos.org/7.8.2003/os/x86_64/Packages/python-urlgrabber-3.10-10.el7.noarch.rpm
wget http://vault.centos.org/7.8.2003/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
wget http://vault.centos.org/7.8.2003/os/x86_64/Packages/rpm-python-4.11.3-43.el7.x86_64.rpm

4.下载结果

python

linux系统重装yum工具与python环境_第3张图片

yum

linux系统重装yum工具与python环境_第4张图片

四、安装

安装python

rpm -ivh python-*   rpm-python-* --nodeps --force

安装yum

rpm -ivh yum-* --nodeps --force

测试:

linux系统重装yum工具与python环境_第5张图片

你可能感兴趣的:(Linux从入门到精通,python,linux,运维)