I use Centos 8.0 and want to install the latest Python 3.

When I run yum command, it tells me

yum: command not found

but when I run rpm -q yum, I have it yum-4.7.0-4.el8.noarch.

Then I try to which yum I get

/usr/bin/which: no yum in (/root/.vscode-server/bin/xxx/bin/remote-cli:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin)

This issue happened after I uninstalled an old Python version via

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

Would you mind giving me some advice on how to solve it?

  • 1
    Does dnf or sudo dnf work? Yum was replaced with DNF in RHEL8 and its derivatives. No idea why the yum command is not available, probably a symlink has been deprecated. " The YUM package manager is now based on the DNF technology and it provides support for modular content, increased performance, and a well-designed stable API for integration with tooling." Mar 28 at 9:59
  • You must never run rpm --nodeps on your production system unless you're OK with your system malfunctioning right away or soon after. I use this command occasionally but I'm a pro user who perfectly knows what they are doing and only apply it the packages which I know for a fact will not break anything. It's best not to use RPM directly at all (though generally it must be safe). Mar 28 at 10:13
  • yum is provided by the package yum. You'll need to run sudo dnf install yum to geT it back. Also, you do know that CentOS 8 reached end of life on 12/31/2022. You should think about moving to a supported OS.
    – doneal24
    Mar 28 at 14:52

1 Answer 1

rpm -qa|grep python3|xargs rpm -ev --allmatches --nodeps

But with that you explicitly ask rpm to uninstall python3-dnf. What did you expect to happen?

You also disabled all safeguards by using --nodeps, because otherwise your system would have denied you to uninstall crucial parts.

Whatever it was that you were trying to achieve, you

  1. explicitly uninstalled dnf and thus the virtual yum (which is just a symlink to dnf, because Centos 8 replaced yum with the largely compatible dnf)
  2. broke your ability to install software on this system by uninstalling the package manager
  3. uninstalled python3, which is essential to a CentOS system

So, you did this to yourself, sorry! You broke your system; it might be quite annoying to restore, because your dependency-breaking uninstallation of all python3 packages will have uninstalled quite a lot of things that you will need to figure out you need.

The easiest way forward here is probably rolling back from your backup, or in absence of a system backup, setting up a new CentOS 8.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .