RHEL 7/8 Kickstart Installation

Gini Gini Follow · 5 mins read
RHEL 7/8 Kickstart Installation
Share this

1. Pre-Requisites

2. Prepare kickstart file

  • Generate kickstart file using Kickstart Generator
  • Add/modify content as needed (like post-scripts, Software RAID etc)

3. Configure Utility Services

3.1. Configure DHCP and DNS

  • Configure DHCP server in same network : We need a dhcp server to provide initial IP for the machine to use, so that it can access the http servers for ISO, Packages and kickstart.cfg
  • Configure a DNS server in same network (Optional)


Sample dhcpd.conf

ddns-update-style none;
option domain-name "lab.local";
ignore client-updates;

allow booting;
allow bootp;
allow unknown-clients;

# internal subnet for my DHCP Server
subnet netmask {
option domain-name-servers;
option routers;
option broadcast-address;
default-lease-time 600;
max-lease-time 7200;

# IP of PXE Server
filename "pxelinux.0";


# cat /etc/dnsmasq.conf |grep -v ^#|grep -v ^$
pxe-prompt="Press F8 for menu.", 10

Setup pxeboot on dnsmasq


## check dnsmasq logs
## find below line in dnsmasq.conf

3.2. Configure a Web Server

  • To keep the ISO for booting and also to store YUM repository.
  • If using PXE, then need to setp tftp server on same.
  • It can be on same machine as DHCP server.

3.3. Download and Preapre RHEL ISO

Refer : Product Downloads

  • Download the minimal boot image ISO (eg: Red Hat Enterprise Linux 8.2 Boot ISO)
  • Download the binary ISO and create a local repository server.

3.4. Configure Repo Server and ISO

  • Deploy a server with http (web server)
  • Copy RHEL7/8 content to a directory on server and enable repo (Refer how to setup local repo server)
  • Copy RHEL7/8 Boot ISO (minimal one) to another directory (if planning remote ISO loading)
  • Copy kickstart to Web server path (eg: /var/www/html/ks/rhel/8/ks.cfg)

Setup a tftp server

TFTP server dnsmasq has built-in TFTP server.

To use it, create a root directory for TFTP (e.g. /srv/tftp) to put transferable files in.

enable-tftp tftp-root=/srv/tftp For increased security it is advised to use dnsmasq’s TFTP secure mode. In secure mode only files owned by the dnsmasq user will be served over TFTP. You will need to chown TFTP root and all files in it to dnsmasq user to use this feature.


4. Setup a PXE Server

# yum install dhcp tftp tftp-server syslinux vsftpd xinetd
# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf

Content of /tftpboot/pxelinux.cfg/default

default menu.c32
prompt 0
timeout 300

label 1
menu label ^1) Install RHEL 8 with Local Repo
kernel rhel8/vmlinuz
append initrd=rhel8/initrd.img method= inst.ks= devfs=nomount
# append initrd=rhel8/initrd.img inst.ks= devfs=nomount
label 2
menu label ^2) Boot from local drive

Configure Firewall

# firewall-cmd --add-service=ftp --permanent
# firewall-cmd --add-service=dhcp --permanent
# firewall-cmd --add-port=69/tcp --permanent 
# firewall-cmd --add-port=69/udp --permanent 
# firewall-cmd --add-port=4011/udp --permanent
# firewall-cmd --reload

5. Boot from ISO and Use kickstart configuration

  • If we are loading ISO manually to VM/Physical servers, the boot from “RHEL7/8 Boot ISO” (either attach to VM or fetch it from http path which you have stored in repo server setup previously)
  • When the ISO installer asks for “Install”, press Tab and add inst.ks= (your http path) and press Enter
  • Installation will kickstart without asking for any answers (unless you missed anything in ks.cfg)

Note : To load your Kickstart file automatically without having to specify the inst.ks= boot option, name the file ks.cfg and place it on a storage volume labeled OEMDRV.

5.1. Automated Booting and Installation

  • If you are planning fully automated installation, you can use PXE booting; it will load basic boot ISO (need to create custom boot images).
  • You can mention the custom ks.cfg in the boot command line itself and installation will not even ask for kickstart file or any answers.

Warning: Only use this method with restricted IP/DHCP/MAC binded network, otherwise it may wipe-out other systems when it reboot !!!

6. Appendix

6.1. References

6.2. Validating Kickstart File - ksvalidator

# yum install pykickstart
$ ksvalidator /path/to/kickstart.ks

## Changes in Kickstart Syntax
$ ksverdiff -f RHEL6 -t RHEL7

6.3. Sample ks.cfg files

Written by Gini Follow
Backpacker, Foodie, Techie

Latest Stories

How To Get Hands-On Experience in AWS

Every Time you have the same situation, you know the technology and maybe you are already a certified professional in that technology, but you are not getting enough hands-on on that ...

In AWS, Jan 04, 2021
Getting Started with Ansible Collections

Ansible Collection is a great way of getting content contributions from various Ansible Developers. Earlier there was a tagline for Ansible – “Batteries included”, but now the battery...

In redhat, ansible, Dec 22, 2020
Configure Your Windows Host to be Managed by Ansible

I was talking to my friend about Ansible automation and how we are implementing automated solutions for cloud and on-premise infrastructure. Then he told me that, his team is looking ...

In redhat, ansible, Dec 01, 2020
Remove nodes from Kubespray Managed Kubernetes Cluster

Kubespray is a combination of Ansible and Kubernetes and you can use Kubespray for deploying production ready Kubernetes clusters. You can manage full-lifecycle of Kubernetes clusters...

In containers, kubernetes, Nov 30, 2020
Adding new nodes to Kubespray Managed Kubernetes Cluster

Kubespray is a combination of Ansible and Kubernetes and you can use Kubespray for deploying production ready Kubernetes clusters. Learn how to add new nodes in a Kubernetes cluster u...

In containers, kubernetes, Nov 27, 2020