In part 1, I walked through the initial network booting process to be able to start the Centos 7.x installation process. In this part, part 2, I’ll continue on to explain the Centos 7.x specific portions of things as well as break down the kickstart configuration file.
Centos 7 Specifics
In the grub.cfg file, the following kernel line:
linux (tftp)/vmlinuz noipv6 inst.repo=http://deploy/repos/centos/7/os/x86_64/ inst.ks=http://deploy/ks.cfg inst.ks.sendmac
has three RedHat/Centos specific items under the inst prefix. Full reference
inst.repo
This option tells the installer (anaconda) where it can find its installation repository. In this case, the web root of our centos7mirror container.
inst.ks
This option tells anaconda where it can find the optional kickstart configuration file. Again in this case, the web root of our centos7mirror container.
inst.ks.sendmac
This option tells anaconda to send the NIC name and mac address of the interface used to request the kickstart inside as special HTTP header named X-RHN-Provisioning-MAC-0. e.g.
X-RHN-Provisioning-MAC-0: eth0 01:23:45:67:89:ab
Custom Kickstart Handler
So, in our /var/www/html/ks.php file, we parse the MAC header and serve up our custom kickstart file if it’s valid and exists as a configuration file. Remember, we use mod_rewrite rules to make any requests for ks.cfg be served by /var/www/html/ks.php:
And here is what’s in /var/www/html/cfg:
Custom Kickstart File
A couple key notes:
The file was created by first performing a manual installation. This ends up as /root/anaconda-ks.cfg after installation completes. I then added a couple packages and then the contents of the post section.
All partitions are cleared and the default partitioning scheme is used
A default account of admin is made
A public SSH key for admin is added to enable access once booted
UseDNS no is changed to speed up SSH access by removing reverse DNS lookups on connection.