There are cases where you do not have access to
dnf. For example, you somehow managed to mess up your system’s python installation, and your package manager won’t start anymore.
dnf are front-ends to
rpm, we can just use
rpm to install packages as an alternative.
rpm can not install packages from repositories, so we have to find the package on our own. If you are on Fedora, you can get a package of the official repository from a Fedora Mirror.
Then we can install the package with:
$ sudo rpm --install <the local or remote address of the package>
So in the case of a messed up python install, we can do:
$ sudo rpm --reinstall http://mirror.csclub.uwaterloo.ca/fedora/linux/updates/32/Everything/x86_64/Packages/p/python3-3.8.6-1.fc32.x86_64.rpm
--reinstall here because we already have the
python3 package installed.
And that’s it! However, if your package depends on other packages, you may need to solve their dependencies by yourself.