Setup for installing CentOS 7 with PXE and kickstart
What is kickstart
After a successful CentOS installation a kickstart file can be found at /root/anaconda-ks.cfg
. A kickstart file contains a set of instructions for the installer to repoduce the current (initial) installation. The file includes the following (and possibly more):
- the image source / repo (disk, http, nfs)
- networking info (links, static or dhcp address configuration)
- partitioning (disks, partitions, raids, lvm, filesystem types, mountpoints)
- package selections (package groups, individual packages)
- services and firewall (can enable ssh and allow access through firewalld)
- users and passwords (as salted hashes, like in
/etc/shadow
) - custom user (post) installation scripts
The kickstart file is machine specific with regards to networking and partitioning configuration. But it can be made quite universal, if dhcp is used for the network setup and all nodes you want to install contain the same number of disks (and a minimum amount of space on each disk).
How do you (we) kickstart
- the node to be installed is configured for PXE boot (via ipmi configuration)
- a DHCP server is present in the network and provides the PXE boot information (TFTP server address and path to bootstrap kernel)
- the DHCP server identifies the node by MAC address, so it has to be known beforehand
- the node loads the bootstrap kernel (syslinux) and interprets the boot config file (default filename is known to PXE)
- the config file either tells the node to boot from disk (regular boot) or to load another kernel with an initramfs and parameters (in our setup this triggers the installation)
- the kernel and initramfs were part of the CentOS 7 iso and the additional parameters specify a NFS path to a kickstart file
- the new kernel fetches the kickstart file from the NFS server and starts the install process
- the packages for the installation are also available over NFS (path is specified in the kickstart file)
- the installation is fully automatic (if no problems occur) and can be monitored via ipmi sol
- after the installation is finished the node can reboot (this is optional and also specified in the kickstart file)
NOTE: to prevent an infinite installation loop you either have to disable PXE boot after the node is successfully installed or you have to edit the PXE bootstrap config file to default to boot from disk instead of triggering the kickstart installation on each reboot.
where are the files
- storagenode (configuration is shared with diskless node PXE boot config)
- DHCP config
/etc/dhcp/dhcpd.conf
- NFS exports
/etc/exports
- TFTP config
/etc/xinetd.d/tftp
- CentOS 7 image (repo)
/tftp/centos7/unpacked
- bootstrap kernel
/tftp/$nodename/pxelinux.0
- bootstrap config
/tftp/$nodename/pxelinux.cfg/default
- CentOS 7 kernel
/tftp/$nodename/vmlinuz
- CentOS 7 initramfs
/tftp/$nodename/initrd.img
- kickstart file
/tftp/$nodename/kickstart.cfg
Issues
- CentOS 7 changed some required paramters of the kickstart file, so you can not just copy your old kickstart file onto the NFS server without editing it first.
- Nodes with differing numbers of disks should use differing kickstart files
- Nodes with multiple network interfaces probably need specialized kickstart files
- Interface naming has changed from CentOS 6 to CentOS 7 (eth0 --> eno1) and may not be fully predictable
- Openstack: Nova (Juno) is not fully backwards compatible to our Icehouse installation (need to upgrade controlnode)