Last active
November 12, 2019 15:44
-
-
Save bgulla/7bbba897b7d75d3bb2cb75002430abe1 to your computer and use it in GitHub Desktop.
Kickstarting a CentOS server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##### | |
# On the host that you want to run your kickstart server (in the folder containing kickstart.cfg): | |
# docker run --restart=always -p 9999:80 -v ${PWD}/kickstart.cfg:/var/www/html/kickstart.cfg nginx | |
##### | |
# Instructions: | |
# - Boot into a fresh CentOS box. When you get presented with the ASCII menu, press tab then type: | |
# ks=http://<IP_OF_KICKSTART_BOX>:9999/kickstart.cfg . Then press enter. | |
## kickstart.cfg | |
##### | |
lang en_US | |
keyboard us | |
timezone America/New_York --isUtc | |
rootpw $1$RbhGBRTh$PpaMQpLQ3FzGYM.2tPQqC. --iscrypted #this sets the root password to changeme | |
#platform x86, AMD64, or Intel EM64T | |
reboot | |
text | |
bootloader --location=mbr --append="rhgb quiet crashkernel=auto" | |
zerombr | |
clearpart --all --initlabel | |
autopart | |
auth --passalgo=sha512 --useshadow | |
selinux --enforcing | |
firewall --enabled | |
firstboot --disable | |
%post --log=/var/log/post.log | |
exec < /dev/tty3 > /dev/tty3 | |
chvt 3 | |
echo "################################" | |
echo "# Running Post Configuration #" | |
echo "################################" | |
echo "[install ssh keys]" | |
mkdir -m0700 /root/.ssh | |
cat <<EOF >/root/.ssh/authorized_keys | |
ssh-rsa PASTE_IN_YOUR_PUBLIC_KEY_HERE | |
EOF | |
chmod 0600 /root/.ssh/authorized_keys | |
restorecon -R /root/.ssh | |
sed -i 's/\#PermitRootLogin yes/PermitRootLogin yes/g' /etc/ssh/sshd_config | |
echo "[install epel release]" | |
yum install -y epel-release | |
yum clean all | |
echo "[install primary packages]" | |
yum install -y git nano cowsay tmux htop ansible yum-utils | |
# echo "exclude=kernel*" >> /etc/yum.conf | |
# update the system | |
echo "[yum update -y]" | |
#yum update -y | |
#Setting docker-repo | |
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo | |
#Installing docker | |
yum clean all | |
echo "[install docker]" | |
yum install -y docker-ce docker-ce-cli nfs-utils --skip-broken | |
systemctl enable docker | |
%end | |
%packages | |
openssh-server | |
%end | |
### End of kickstart.cfg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment