This is like a 'chicken and egg' question. RPM package manager (similarly other package management programs) is packaged in an RPM package itself and installed. But then how is RPM initially installed? Likewise, if RPM is (forcefully) uninstalled, then how can it be installed back?

  • The same question could be asked about any package manager. If you made the question about the chicken-egg problem of package managers in general you would make it easier for non-Red Hat people to answer. Alternatively, if there is something special about Red Hat, it might help if you explain what the relevance is. Eg, do you have something in mind you plan to do with RPM in particular? – cryptarch Dec 21 '18 at 2:49

The installer ("anaconda" on CentOS) bootstraps the rpm environment by writing out the base files, then does the initial set of installs in a chroot environment. The rpm program from the installer exists outside of the install, and so isn't dependent on those files.

If you need to reinstall rpm then I'd recommend booting the installer into rescue mode and using the rpm command from that environment with the --root option to point to the OS you want to fix.

| improve this answer | |

You can "always" extract the RPM contents, e.g., using rpm2cpio, and put the executables/scripts where they can be used to install packages. Call that a bootstrap process...

| improve this answer | |
  • rpm2cpio will extract the content of the rpm package. It will not execute the rpm scriptlets. So, it is not equivalent to rpm -i. But this does not answer my question: how is rpm initially installed? – drgnfr Dec 21 '18 at 2:19
  • For that, you'll have to read the installer provided on various ISO media. They don't bake the resulting filesystem ahead of time; it's built up by running programs. – Thomas Dickey Dec 21 '18 at 9:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.