How to integrate kickstart file in the PXE Server to automate Operating System Installation
Updated: Oct 3, 2021
In my previous post, I have described how to start with the PXE server for the network operating system installation. See the below link, if missed out.
Now I am going to create a kickstart file and integrate it with the PXE Boot server to automate Operating System Installation, without any user intervention. During the Operating System Installation kickstart file will decide:
The filesystem structure.
The package group that will be installed
Any post configuration and so on.
Step:1 Need to set the root password (encrypted string) in the kickstart file. OpenSSL command can help us to convert any text to encrypted string as below:
# openssl passwd -1 Redhat123
$1$jiA3FLdA$YHu//9xCxolp2lhMzbqYO1
Step:2 To create a sample Kickstart file that can be used to install RHEL.
# vi /var/ftp/pub/rhel7-ks.cfg
######
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use FTP installation media
url --url="ftp://192.168.122.144/pub/rhel7/"
# Root password
rootpw --iscrypted $1$jiA3FLdA$YHu//9xCxolp2lhMzbqYO1
# System authorization information
auth useshadow passalgo=sha512
# Use graphical install
graphical
firstboot disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux disabled
# Installation logging level
logging level=info
# System timezone
timezone Asia/Kuala_Lumpur
# System bootloader configuration
bootloader location=mbr
clearpart --all --initlabel
part swap --asprimary --fstype="swap" --size=1024
part /boot --fstype xfs --size=300
part pv.01 --size=1 --grow
volgroup root_rhel pv.01
logvol / --fstype xfs --name=lv_01 --vgname=root_rhel --size=1 --grow
%packages
@^minimal
@core
kexec-tools
%end
%addon com_redhat_kdump --disable --reserve-mb='auto'
%end
%post --erroronfail
nodectl init
%end
Note: The below labs URL is provided by Red Hat and can be used to build your customized Kickstart file: https://access.redhat.com/labs/kickstartconfig/
Step:3 To add/change PXE menu file (/var/lib/tftpboot/pxelinux.cfg/default) and make sure the following contents into the pxe menu file.
# vim /var/lib/tftpboot/pxelinux.cfg/default
::::::::::::: CUT SOME OUTPUT :::::::::::::
label 5
menu label ^5) Install RHEL 7 1xETH,KS
kernel rhcos/vmlinuz
append initrd=rhcos/initrd.img inst.repo=ftp://192.168.122.144/pub/rhel7/ ks=ftp://192.168.122.144/pub/rhel7-ks.cfg
::::::::::::: CUT SOME OUTPUT :::::::::::::
Step:4 To verify and boot the client systems with the PXE boot with the KS option.
We can select the installation method 5 from the PXE Boot menu screen. And after that, It will complete the installation without prompting any further input from you.
Hope this document will help.
댓글