Linux – Installing yum repositories that are specified in kickstart file

kickstartlinuxredhatyum

Right now, I am specifying repositories to be used for installation in the kickstart file via the repo directive. I am then, re-specifying those repositories to be added to the /etc/yum.repos.d post-installation.

Is there an elegant way to avoid the duplication of information? It has bitten me in the butt once already.

Clarification:

Perhaps I am understanding this incorrectly but: it seems that the repo directive is only used for specifying the repositories that are used by anaconda for installation. It does not actually install the repo on the server. I'm basing this presumption on my experience with kickstart installs.

This is why I install the repositories again post-install. I want to know if there is a better way so I do not have to specify the repositories in both the repo directive and in my post-install script.

Best Answer

In the post section of your kickstart include something like this:

%post
cat >/etc/yum.repos.d/your.repo <<EOF
[... INCLUDE REPO CONFIG FILE CONTENTS HERE ...]
EOF