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:

  1. Install minimal system via GUI
  2. Install default packages
  3. Setup Vim config
  4. Disable/remove SELinux
  5. Setup default bash prompt
  6. Remove SSH keys
  7. rm /etc/ssh/*key*
  8. New keys will be generated on boot
  9. Set generic hostname
    1. echo new-virt.web-ster.com > /etc/hostname
  10. Remove mac address line from network config
  11. Replace chrony with NTPd
    1. yum -y swap chrony ntp
  12. Enable NTPd
  13. Disable firewalld
    1. systemctl mask firewalld
  14. Set grub default boot time to two seconds
    1. perl -pi -e 's/GRUB_TIMEOUT=\d/GRUB_TIMEOUT=2/' /etc/default/grub
    2. grub2-mkconfig -o /boot/grub2/grub.cfg
  15. Shutdown VM and archive the disk image


Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 18.97.9.173
To prevent spam please submit by clicking the kitten: