0

To clarify, I am wondering how you can install RPM on a system at the installation time. Yes, I know that to install you use "rpm -i", but that is not the question.

My point is that when you install a new CentOS for instance, we will

  1. Boot on a minimal system
  2. Start the graphical environment
  3. Configure the UI parameter for the installation process
  4. Setup the disk (partitioning, formatting)
  5. List the packages you are expecting to install
  6. Install those packages
  7. Create user accounts and stuff

And all of this will be managed by Anaconda.

My point is that I know how you create the partitions (fdisk, parted, etc...), I know how to format them (mkfs, ...), then you can create the filesystem tree (mkdir, ...), but then how would you be able to deploy the RPM, since there is no RPMDB, and no RPM utility deployed.

I guess that a chroot might be involved so that you can isolate your new system, then we're on our own. Needless to say when checking about RPM installation, I just get basic RPM installation commands. Any tracks to provide on how we would be able to do that ?

2 Answers 2

1

All the steps you mentioned are done from a different system. Either PXE boot or CD/USB ISO. So you have all tools you previously put on that image.

What Anaconda does in step 6 is (simplified):

  • mount the disk to /mnt/newroot
  • rpm --root *.rpm

RPM will create rpmdb when it does not exist there.

Obviously, it is better to do the installation in two steps: first, install rpms to make a minimal system and then the rest. This way you have to care less about pre-scriptlets requiring something on the system.

This scenario is the reason why documentation urges everybody to write pretrans scriptlets in LUA. Because before transaction, there is nothing on the system.

2
  • Thank you very much for highlighting this option. Even though I checked the documentation, I never noticed it.
    – Olivier M.
    Commented Mar 24, 2022 at 5:49
  • Your answer put me on the right track. A complete command would be something like rpm -iv --nodeps --root /mnt/iya/ --dbpath=/var/lib/rpm tar-1.34-IYA.Linux.x86_64.rpm
    – Olivier M.
    Commented Mar 29, 2022 at 12:47
0

You may generate your own custom ISO that will contain all the packages you require.

The process is described in detail in the article 9 easy steps to create custom ISO RHEL/CentOS 8.

This allows you to actually limit your generated ISO to contain only packages that you need, thereby reducing its size.

1
  • Thank you for this link that is very interesting, but still does not answer the original question, since I'd really like to understand the process that makes Anaconda work.
    – Olivier M.
    Commented Mar 22, 2022 at 5:23

You must log in to answer this question.

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