"Sysprep" for Linux after cloning VMs?

Root Loop asked:

If I clone a Windows VM (Server or Desktop), I need to perform a “sysprep” to change SID.

Wondering that if I clone a Linux VM, is there anything similar to “sysprep” must be done?

I am using CentOS 7.

My answer:

That’s exactly what virt-sysprep is for.

From the man page:

Virt-sysprep can reset or unconfigure a virtual machine so that clones can be made from it. Steps in this process include removing SSH host keys, removing persistent network MAC configuration, and removing user accounts. Virt-sysprep can also customize a virtual machine, for instance by adding SSH keys, users or logos. Each step can be enabled or disabled as required.

You can use virt-sysprep on any disk image format that your version of qemu understands. This usually includes raw disk images, qcow2, VMware VMDK, Windows VHD, VirtualBox VDI, and many others.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.