Sample Kickstart file for CentOS7

Below is sample Kickstart file for CentOS7 installation via 
network:
#CentOS install via network
# System language
lang en_US
# Keyboard layouts
keyboard us
# System timezone
timezone Asia/Kolkata --isUtc
# Root password
rootpw --iscrypted encrypted-password
#platform x86_64
reboot
url --url=http://repos.example.com/repos/centos78/
bootloader --append="rhgb quiet crashkernel=auto"
zerombr
# Partition clearing information
clearpart --all --initlabel
#autopart
# Disk partitioning information
part /boot --fstype="xfs" --ondisk=sda --size=1024
part pv.252 --fstype="lvmpv" --ondisk=sda --size=60415
volgroup rhel --pesize=4096 pv.252
logvol swap  --fstype="swap" --size=4096 --name=swap --vgname=rhel
logvol /  --fstype="xfs" --size=56315 --name=root --vgname=rhel

# Network Details
network --device=ens192 --hostname=test.example.com --bootproto=static --ip=192.168.1.100 --netmask=255.255.255.0 --gateway=192.168.1.1
auth --passalgo=sha512 --useshadow
selinux --disabled
firewall --disabled
firstboot --disable
%packages
@^minimal
@system-admin-tools
@development
@compat-libraries
@core
net-tools
curl
elinks
wget
expect
%end

%addon com_redhat_kdump --enable --reserve-mb='auto'

%end

%post
# Add required enteries in hosts file.
printf "192.168.1.10\repos.example.com\n" >> /etc/hosts
printf "$(hostname -I)\t$HOSTNAME\n" >> /etc/hosts

#Post install tasks
cd /tmp/
wget http://repos.example.com/scripts/post_ks.sh
chmod 755 post_ks.sh
/bin/sh post_ks.sh
/usr/sbin/useradd -c "Test Account" -p 'encrypted password' test1
/usr/sbin/useradd -c "Admin User" -G wheel -p 'encrypted password' test2
%end

Leave a Reply

Your email address will not be published. Required fields are marked *