I'm currently installing RHEL 6 using a kickstart file. I'm attempting to conditionally install a package. The order of when the package is installed does not matter to me.

Right now, my %post section looks like this


if [ conditionExists ]
    yum install packagename

However, this does not work. My assumption is that yum is failing due to the fact that it is no longer pointing to the repo on the installation media, and instead pointing at the repo on the system.

What options are available when it comes to this problem? Is there a way to point the yum repo back to the installation media in the %post section? Is there a way to install the package in the %pre section without having an issue?

  • Unfortunately 'does not work' does not provide enough information about the problem. Anybody trying to help you will require at a very least the error messages you see when performing an installation. – dawud Dec 6 '16 at 15:48
  • Hi @dawud it says that "Yum can't find the specified package". I can confirm that the package definitely is in the yum repo local to the installation media. When I add the package into the %packages section of the kickstart file, it installs just fine. – Brian5193 Dec 6 '16 at 15:52
  • This is something that I would do after installation, in configuration management. – Michael Hampton Dec 6 '16 at 18:54

It should be:

yum install -y packagename

To avoid yum stopping to prompt for confirmation

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.