Skip to content

Instantly share code, notes, and snippets.

@aberranthacker
Last active May 2, 2018 00:24
Show Gist options
  • Save aberranthacker/1d0f4664efaa9639079ae1ea50bcdb12 to your computer and use it in GitHub Desktop.
Save aberranthacker/1d0f4664efaa9639079ae1ea50bcdb12 to your computer and use it in GitHub Desktop.
CentOS 7.2 kickstart file
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
cdrom
# Perform the kickstart installation in text mode
text
# X will not be configured
skipx
# Don't run the Setup Agent on first boot
firstboot --disable
# Keyboard layout
keyboard us
# System language
lang en_US.UTF-8
# Network information
network --onboot=yes --device=eth0 --bootproto=dhcp --noipv6 --activate
# Root password
rootpw --plaintext vagrant
# System timezone
timezone Europe/Moscow
user --groups=wheel --name=vagrant --password=vagrant
%include /tmp/kspre.cfg
reboot
%packages
@^minimal
@core
%end
%addon com_redhat_kdump --disable --reserve-mb='auto'
%end
%pre
if [ -b "/dev/vda" ] ; then
bootdrive=vda
elif [ -b "/dev/sda" ] ; then
bootdrive=sda
else
exec < /dev/tty3 > /dev/tty3
chvt 3
echo "ERROR: Can't find a drive device to install to!"
sleep 5
halt -f
fi
cat >/tmp/kspre.cfg <<CFG
# Partition clearing information
# Initializes the disk label to the default for your architecture
clearpart --none --initlabel
autopart
# Specifies a list of disks for the installer to use
ignoredisk --only-use=$bootdrive
# System bootloader configuration
bootloader --location=mbr --boot-drive=$bootdrive
CFG
%end
%post
echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant
echo "Defaults:vagrant !requiretty" >> /etc/sudoers.d/vagrant
chmod 0440 /etc/sudoers.d/vagrant
%end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment