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 attend Red Hat Remote Exam ? Every details you need to know

In August 2020, Red Hat announced the availability of Remote exams for students and the entire Learning community were so happy, yes we can attend Red Hat exams from our home or offic...

In redhat, Nov 09, 2020
How to Import Existing VMWare VM’s into Terraform

Terraform is an amazing tool for your infrastructure automation. Everything about your infrastructure can be write as code and maintain by team; means your infrastructure is transpare...

In terraform, Nov 04, 2020
Connecting Ansible Tower to Git Server with Self Signed Certificates

So many questioned me when I mention git server in an Ansible Tower environment; and later I realized that, most of them are keeping their projects inside Ansible Tower !!!

In Ansible, Oct 12, 2020
HashiCorp Certified Terraform Associate – Learning & Exam Tips

I started using Terraform somewhere in 2018, but very limited usage as I thought it is just another tool for provisioning infrastructure and other services – or a variant of Vagrant; ...

In terraform, Sep 18, 2020
How to Pass CKA & CKAD Exams ? 10 Tips for Kubernetes Exams

Here see the best tips for Kubernetes Exams - Certified Kubernetes Administrator (CKA) & Certified Kubernetes Application Developer (CKAD).

In kubernetes, Aug 15, 2020