Date created: Monday, March 6, 2017 5:00:01 PM. Last modified: Wednesday, January 4, 2023 9:57:28 PM

Kickstart Example

References:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Installation_Guide/sect-kickstart-syntax.html

Example kickstart file for PXE booting CentOS 7:

#platform=x86, AMD64, or Intel EM64T
 #version=DEVEL

 # Firewall configuration
 #firewall --disabled
 firewall --enable --service=ssh
 # If using a minimal install the package system-config-firewall-base is not included by default,
 # so it must be added out in the %packages section.

 # Install OS instead of upgrade
 install

 # Use HTTP installation media
 url --url="http://10.116.25.249/centos7_x64/"

 # Root password [password is 000000]
 rootpw --iscrypted $6$SdF2SElEebstC49Z$kjH8jJ6rqgmErwgxbdEP4eMKT9anAAnfrAoolSG/cJ7Fl1sZpnlfZ7fWL5KcvjhbAVXvcKTl2VW.dtAMCF4d/1

 # Add user standard lab account
 user --name=myadmin --groups=wheel --homedir=/home/myadmin --iscrypted --password='xxxxxxx' --shell=/bin/bash

 # System services
 services --enabled="chronyd"
 services --enabled="rc-local"

 # Network information
 network  --bootproto=dhcp --device=eno1 --onboot=on --ipv6=dhcp --hostname={{ ucpe.settings.hostname }}
 # Example with static IPv4 and DHCP IPv6:
 # network  --bootproto=static --ip=10.116.25.250 --netmask=255.255.255.248 --gateway=10.116.25.249 --nameserver=10.116.25.249 --device=eno1 --onboot=on --ipv6=dhcp --hostname=ucpe_003
 # Apart from the first device which is activated by default, all subsequent devices without --activate are disabled

 # System authorization information
 auth  useshadow  passalgo=sha512

 # Use graphical install (a monitor can be attached for debugging purposes)
 graphical
 firstboot disable

 # Keyboard layouts
 keyboard --vckeymap=gb --xlayouts='gb'
 # System language
 lang en_GB.UTF-8
 # Timezone
 timezone Europe/London  --isUtc

 # SELinux configuration
 ##selinux disabled

 # Installation logging level
 logging --level=info

 # System bootloader configuration - this machine is KVM hense the pstate/Iommu settings below
 bootloader location=mbr --append="intel_pstate=disable iommu=pt intel_iommu=on"

 # Erase any existing disk partitions
 zerombr
 clearpart --all --drives=sda,sdb --initlabel

 # Size is in megabytes so 20GBs for / and 100MBs for /boot/efi
 ignoredisk --only-use=sdb
 part /boot/efi --fstype="efi" --ondisk=sdb --size=100 --fsoptions="umask=0077,shortname=winnt"
 part / --fstype="ext4" --ondisk=sdb --size=20000

 # Reboot at the end
 reboot

%packages
@^minimal
@core
chrony
kexec-tools
%end

%post
# Download a config file for the first NIC on the system with a static IP configured
curl -o /etc/sysconfig/network-scripts/ifcfg-eno1 http://10.116.25.249/94-18-82-ab-ae-93-ifcfg-eno1
# Disable 169 addresses
echo "NOZEROCONF=yes" >> /etc/sysconfig/network
# Enabled IPv6
echo "NETWORKING_IPV6=yes" >> /etc/sysconfig/network
# Download any additional files or scripts that need to be on the remote device
curl -o /etc/rc.d/ens2f0-vfs.sh http://10.116.25.249/94-18-82-ab-ae-93-ens2f0-vfs.sh
curl -o /etc/rc.d/ens2f1-vfs.sh http://10.116.25.249/94-18-82-ab-ae-93-ens2f1-vfs.sh
# Make an HTTP POST back to a provisioning system (Ansible Tower in this example) to signal the end of the PXE install process
curl -k --data "host_config_key=xxxxxxxx" http://10.116.25.249/api/v1/job_templates/1/callback/
%end

#%packages
# @core
# wget
# net-tools
# %end
# %post
# %end

Previous page: keepalived
Next page: Kubernetes