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
    1. rm /etc/ssh/*key*
    2. New keys will be generated on boot
  7. Set generic hostname
    1. echo new-virt.web-ster.com > /etc/hostname
  8. Remove mac address line from network config
  9. Replace chrony with NTPd
    1. yum -y swap chrony ntp
  10. Enable NTPd
  11. Disable firewalld
    1. systemctl mask firewalld
  12. 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
  13. Shutdown VM and archive the disk image


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

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