I made a mistake with sudo yum remove python, but I don't know how to put it back.

Asked 5 months ago, Updated 5 months ago, 11 views

I ran sudo yum remove python on centos.
Some functions of centos are no longer available.
sudo yum install python does not allow some functions of centos to be used.
How can I restore it to its original state?

The CentOS version is
CentOS Linux release 7.9.2009 (Core)

I think that the dependency package, not the library, has been deleted.
sudo yum remove python caused a large number of deletions.

sudorpm-Uvh --replacepkgs*.rpm allows you to run

Error: Lack of dependency:
    python-rpm-macros>3-30 is required for python-develop-2.7.5-89.el7.x86_64
    python2-rpm-macros>3-30 is required for python-develop-2.7.5-89.el7.x86_64


python linux centos

2022-09-30 13:51

1 Answers

Please note that the following is a reference to one of the reinstalling python on CentOS to be able to use yum-Server Fault answers, which I did not actually try.

In CentOS, Python is an OS-related package, so the yum command may have been removed as a dependent package at the time of deletion.

First, try reinstalling the minimum required packages using the following steps:

##Go to the directory for work
$ cd/tmp

### Download required package files
$ wget http://ftp.iij.ad.jp/pub/linux/centos/7.9.2009/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
$ wget http://ftp.iij.ad.jp/pub/linux/centos/7.9.2009/os/x86_64/Packages/python-2.7.5-89.el7.x86_64.rpm
$ wget http://ftp.iij.ad.jp/pub/linux/centos/7.9.2009/os/x86_64/Packages/python-devel-2.7.5-89.el7.x86_64.rpm
$ wget http://ftp.iij.ad.jp/pub/linux/centos/7.9.2009/os/x86_64/Packages/python-libs-2.7.5-89.el7.x86_64.rpm

### Installing a Package with the rpm Command
$ sudorpm-Uvh --replacepkgs*.rpm

Also, since the log of package operations in the yum command may be logged in /var/log/yum.log*, it may be a hint to determine which package you accidentally deleted.


If you see missing packages when executing the rpm command, check and download the packages each time from the mirror site directory.

$wget http://ftp.iij.ad.jp/pub/linux/centos/7.9.2009/os/x86_64/Packages/python-rpm-macros-3-34.el7.noarch.rpm
$ wget http://ftp.iij.ad.jp/pub/linux/centos/7.9.2009/os/x86_64/Packages/python2-rpm-macros-3-34.el7.noarch.rpm

2022-09-30 13:51

If you have any answers or tips

© 2023 OneMinuteCode. All rights reserved.