Skip to content

Instantly share code, notes, and snippets.

@bodsch
Created September 2, 2019 12:28
Show Gist options
  • Save bodsch/54d5969ba17b161f2f1d2e88f708ab74 to your computer and use it in GitHub Desktop.
Save bodsch/54d5969ba17b161f2f1d2e88f708ab74 to your computer and use it in GitHub Desktop.
kickstart file for centos
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
cdrom
# Use text or graphical install
text
#graphical
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=vda
# Keyboard layouts
keyboard --vckeymap=de --xlayouts='de'
# System language
lang de_DE.UTF-8
# Network information
network --bootproto=dhcp --device=eth0 --activate
network --hostname=localhost.localdomain
# Set repo to mirror.centos.org
repo --name="CentOS" --baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ --cost=100
repo --name="Updates" --baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ --cost=100
# Root password
rootpw xxx
## rootpw --iscrypted <ENCRYPTED_PASSWORD>
# System services
services --enabled="chronyd"
# System timezone
timezone Europe/Berlin --isUtc
# user --groups=wheel --name=stack --password=<ENCRYPTED_PASSWORD> --iscrypted --gecos="stack"
# System bootloader configuration
bootloader --append=" crashkernel=auto tsc=reliable divider=10 plymouth.enable=0 console=ttyS0 " --location=mbr --boot-drive=vda
# partitions
zerombr
clearpart --all --drives=vda --initlabel
part /boot --fstype ext4 --size=1024
part swap --size=1024
part pv.01 --size=1000 --grow --ondisk=vda
volgroup s pv.01
logvol / --vgname=s --fstype=xfs --size 2048 --grow --name=root
logvol /var/log --vgname=s --fstype=xfs --size=1024 --name=var_log
logvol /tmp --vgname=s --fstype=xfs --size=512 --name=tmp
selinux --permissive
# Installation logging level
logging --level=debug
reboot
%packages
@^minimal
@core --nodefaults
chrony
nano
net-tools
kexec-tools
# Exclude packages that are not needed in a VM image
-aic94xx-firmware
-alsa-*
-btrfs-progs*
-centos-logos
-dracut-config-rescue
-dracut-network
-microcode_ctl
-NetworkManager*
-ivtv-firmware
-iwl*firmware
-plymouth*
%end
%post --log=/var/log/ks.post02.log
#!/bin/bash
# set -x
# MOTD symlinks
ln -sf /etc/motd /etc/issue
ln -sf /etc/motd /etc/issue.net
# Make sure we have the latest security updates
/usr/bin/yum clean all
/usr/bin/yum update -y
# Clean up all yum caches
/usr/bin/yum clean all
# Tune Linux vm.dirty_background_bytes (IMAGE-439)
# The following tuning causes dirty data to begin to be background flushed at
# 100 Mbytes, so that it writes earlier and more often to avoid a large build
# up and improving overall throughput.
echo "vm.dirty_background_bytes=100000000" >> /etc/sysctl.conf
# Disable kdump
systemctl disable kdump.service
%end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment