2.5. Sealing a Linux Virtual Machine Manually for Deployment as a Template

Summary
Generalize (seal) a Linux virtual machine before making it into a template. This prevents conflicts between virtual machines deployed from the template.

Procedure 2.1. Sealing a Linux Virtual Machine

  1. Log in to the virtual machine. Flag the system for re-configuration by running the following command as root:
    # touch /.unconfigured
  2. Remove ssh host keys. Run:
    # rm -rf /etc/ssh/ssh_host_*
  3. Set HOSTNAME=localhost.localdomain in /etc/sysconfig/network
  4. Remove /etc/udev/rules.d/70-*. Run:
    # rm -rf /etc/udev/rules.d/70-*
  5. Remove the HWADDR= line from /etc/sysconfig/network-scripts/ifcfg-eth*.
  6. Optionally delete all the logs from /var/log and build logs from /root.
  7. Shut down the virtual machine. Run:
    # poweroff
Result
The virtual machine is sealed and can be made into a template. You can deploy Linux virtual machines from this template without experiencing configuration file conflicts.