before you can deploy a virtual machine in bulk, you need to prepare the virtual machine template for cloning to prevent the machine properties that are generated by cloning, such as the NIC MAC addresses, etc.) are identical and require the machine to be encapsulated before being made into a virtual machine template. Windows machines can be encapsulated with the Sysprep tool, andLinux does not have a similar tool that requires manual manipulation. The following is a brief description of its operation steps.
1. Run the following command as the root user to identify the reconfiguration system
# Touch/.unconfigured
2. Delete the SSH host key
# rm-rf/etc/ssh/ssh_host_*
3. Delete MAC address
3.1 first stop using the network port
# Ifdown Eth0
3.2 then edit the/etc/sysconfig/network-scripts/ifcfg-eth0 file, delete the HWADDR entry (formatted as below), and then save the file.
hwaddr=00:ab:cd:12:34:56
3.3 finally re-enable the network port
# ifup Eth0
4. Edit The/etc/udev/rules.d/70-persistent-net.rules file, delete the gateway eth0 entry (in the form below), and then save the file.
subsystem== "NET", action== "Add", drivers== "? *", attr{address}== "00:ab:cd:12:34:56", attr{type}== "1", kernel== "eth*" , name= "Eth0"
5. turn off the virtual machine
# Poweroff
now Linux virtual machines have been encapsulated and can be used to create virtual machine templates.
This article is from the IT Operations blog, so be sure to keep this source http://itops.blog.51cto.com/2420369/1855446
How to encapsulate a Linux virtual machine