How to encapsulate a Linux virtual machine

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.