Linux: Build a base VM image
When a new version of a distro comes out I like to build a base VM image that I can use later to turn up new VMs quicker. Here are the steps I use on a CentOS or Fedora VM image:
- Install minimal system via GUI
- Install default packages
- Setup Vim config
- Disable/remove SELinux
- Setup default bash prompt
- Remove SSH keys
rm /etc/ssh/*key*
- New keys will be generated on boot
- Set generic hostname
echo new-virt.web-ster.com > /etc/hostname
- Remove mac address line from network config
- Replace chrony with NTPd
yum -y swap chrony ntp
- Enable NTPd
- Disable firewalld
systemctl mask firewalld
- Set grub default boot time to two seconds
perl -pi -e 's/GRUB_TIMEOUT=\d/GRUB_TIMEOUT=2/' /etc/default/grub
grub2-mkconfig -o /boot/grub2/grub.cfg
- Shutdown VM and archive the disk image