Custom boot ISO with latest patches applied
I have the concept on how to download the latest RHEL 7.x ISO, and create my own custom boot ISO with a kickstart (ks.cfg) file. I need to know how to apply the latest package updates into the ISO. I tried just doing a copy of the latest packages to the Package directory, but the boot loader formats the disk, then fails on loading any of the packages (see attached screenshot).
Does anyone have any insight on what steps I need to perform to get this to work?
Responses
The only way I found to do this is not very elegant. I make an iso directory structure from an existing RHEL7 ISO (do this by loopback mounting the iso, copying the files to a new directory, and using genisoimage to make a new iso). Before I do the genisoimage, I make a second directory called "isoupdate" in the top of the new iso directory tree
mkdir isoupdate
reposync --repo=updates --downloadonly --forcearch x86_64 --download-path=./isoupdate
createrepo --update -g comps.xml isoupdate/updates
The 'comps.xml' is taken from the original ISO Then I modify the kickstart file(s) to add code that copies the isoupdate/updates to somewhere on the installed OS at installation time to somewhere like /opt/yum/isoupdate and copy commands so it copies a isoupdate.repo file for the local repo to /etc/yum.repos.d/isoupdate.repo pointing to the isoupdate repo and does
yum update -y /opt/yum/isoupdate/updates/*rpm
The ISO is then built with genisoimage as usual You get a ton of warnings at ISO installation time about trying to update packages you don't have installed, but the relevant packages will update.
The negatives: 1) makes the ISO much larger than it needs to be, this is because isoupdate/updates is every package that's updated since the OS release, tons of those are packages you didn't install.
positives 1) The isoupdate/updates files can be useful to have later. If you have a standalone host with no network, you can install a base package from the iso, then update it using the files in /opt/yum/isoupdate/updates
What could work - untested :) Put the repository somewhere inside the iso and then reference it in your kickstart as an additional repository (see repo in https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/installation_guide/sect-kickstart-syntax), --baseurl=file:///mnt/source/YOURDIR should work
and reposync only latest content, otherwise it'll blow up :)
Downside: afaik red hat recommends to use the kickstart repositories (ie dvdcontent) as is and update during post install. You could do the same -- just create a .repo file in post and run yum update -y
you could take the baseline iso, install it to a VM, immediately do a "yum check-update" use that output to make a list of the rpms it would have needed to update a baseline to now. Then use 'yumdownloader' to download just those rpms, put those rpms in the same "isoupdate" I explained in my post and run the createrepo just like I showed. This should make the isoupdate a much smaller set of rpms.
cd isoupdate/Packages
yum check-update > listoffiles
//edit the listoffiles file to remove all lines that are not just the filenames
for file in `cat listoffiles`
do
yumdownloader --resolve $file
done
createrepo --update -g comps.xml . (note dot is intended)
Hint to Redhat, it would be very useful to have a simulation mode, some way to query the update repo for simply a list of rpms to update to go from baseline to now something like:
yum check-update --osver=7.5 --now > filelist (note this is hypothetical)
so that you wouldn't have to do that VM install but could just run yum check-update with those flags from any version of the os
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
