Skip to content

Instantly share code, notes, and snippets.

@oncipriani
Last active July 30, 2019 12:10
Show Gist options
  • Save oncipriani/641a8426960a0998232e94cc2135497b to your computer and use it in GitHub Desktop.
Save oncipriani/641a8426960a0998232e94cc2135497b to your computer and use it in GitHub Desktop.
Kickstart file for CentOS 7.
#
# Kickstart file for CentOS 7
#
# General options
auth --passalgo=sha512 --useshadow
keyboard --vckeymap=us --xlayouts=us
lang en_US.utf8
reboot --eject
rootpw --plaintext entra@Lab!
text
timezone America/Sao_Paulo --isUtc --nontp
cdrom
# Service/general configuration
firewall --disabled
firstboot --disabled
selinux --enforcing
services --disabled=systemd-readahead-collect,systemd-readahead-replay
# Disk configuration
zerombr
ignoredisk --only-use=sda
clearpart --drives=sda --all --initlabel
bootloader --boot-drive=sda --append="elevator=noop"
autopart --type=plain --nohome
# Network configuration
%include /tmp/network-include.cfg
# Package selection
%packages --ignoremissing
@^minimal
@core
deltarpm
vim-enhanced
%end
# Disable Kdump
%addon com_redhat_kdump --disable
%end
# Network configuration file creation
%pre --interpreter=/bin/sh
#!/bin/sh
if (grep -q 'ip=[0-9.]*::' /proc/cmdline); then
NS="$(grep -o 'nameserver=[0-9.]*' /proc/cmdline | cut -f2 -d'=' | paste -s -d,)"
IFS=':' read IP EMPTY GW NM HN INT NONE <<< $(grep -o 'ip=.*:none' /proc/cmdline | cut -c4-)
echo "network --device=link --onboot=true --noipv6 --bootproto=static --ip=$IP --netmask=$NM --gateway=$GW --nameserver=$NS --hostname=$HN" > /tmp/network-include.cfg
else
echo "network --device=link --onboot=true --noipv6 --bootproto=dhcp" > /tmp/network-include.cfg
fi
%end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment