Skip to content

Instantly share code, notes, and snippets.

@vlj91
Last active July 12, 2018 00:32
Show Gist options
  • Save vlj91/0dfeed1a18d5f4921d80d5079307bb6e to your computer and use it in GitHub Desktop.
Save vlj91/0dfeed1a18d5f4921d80d5079307bb6e to your computer and use it in GitHub Desktop.
kickstart.sh
#!/bin/bash
mirror="http://optus.net/centos/7/os/x86_64"
ks_url="https://gist.githubusercontent.com/vlj91/1e3c367eb14b00e78abad6df52257591/raw/663b5297a46f07329ff170aa4e64e374703fc03b/centos7.ks"
mkdir -pv /boot
curl "${mirror}/isolinux/initrd.img" > /boot/initrd.img
curl "${mirror}/isolinux/vmlinuz" > /boot/vmlinuz
curl "${ks_url}" > /boot/kickstart.ks
echo "menuentry 'centosinstall' {
set root='hd0,msdos1'
linux /boot/vmlinuz ip=dhcp ksdevice=eth0 ks=hd:xvda1:/boot/kickstart.ks method=${mirror} lang=en_US keymap=us
initrd /bootinitrd.img
}" >> /etc/grub.d/40_custom
echo 'GRUB_DEFAULT=saved
GRUB_HIDDEN_TIMEOUT=
GRUB_TIMEOUT=2
GRUB_RECORDFAIL_TIMEOUT=5
GRUB_CMDLINE_LINUX_DEFAULT="quiet nosplash vga=771 nomodeset"
GRUB_DISABLE_LINUX_UUID=true' > /etc/default/grub
grub2-set-default 'centosinstall'
grub2-mkconfig -o /boot/grub2/grub.cfg
rm -rf ~/.ssh/*
rm -rf /root/*
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment