本文共 3356 字,大约阅读时间需要 11 分钟。
Now that you know how to create a virtual machine, you can save its settings into a template. This template will retain the original virtual machine's configurations, including virtual disk and network interface settings, operating systems and applications. You can use this template to rapidly create replicas of the original virtual machine.
To make a Fedora virtual machine template, use the virtual machine you created in Section 4.1.1, “Create a Fedora Virtual Machine” as a basis. Before it can be used, it has to be sealed. This ensures that machine-specific settings are not propagated through the template.
To prepare a Fedora virtual machine for use as a template
连接到一个已经存在的虚拟机, 需要配置一下, 然后关机才能作为模板使用. 例如touch一个重新配置文件, 删除ssh host key.
1. Connect to the Fedora virtual machine to be used as a template. 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. Shut down the virtual machine. Run:
# poweroff
4. The virtual machine has now been sealed, and is ready to be used as a template for Linux virtual machines.
关闭虚拟机后, 创建模板
To create a template from a Fedora virtual machine
1. In the administration portal, click the Virtual Machines tab. Select the sealed Red Hat Enterprise Linux 6 virtual machine. Ensure that it has a status of Down.
2. Click Make Template. The New Virtual Machine Template displays.
3. Click OK. The virtual machine displays a status of "Image Locked" while the template is being created. The template is created and added to the Templates tab. During this time, the action buttons for the template remain disabled. Once created, the action buttons are enabled and the template is ready for use.
In the previous section, you created a Fedora template complete with pre-configured storage, networking and operating system settings. Now, you will use this template to deploy a pre-installed virtual machine.
To clone a Fedora virtual machine from a template
新建虚拟机, 选择基于模板.
1. Navigate to the Tree pane and click Expand All. Click the VMs icon under the Default cluster. On the Virtual Machines tab, click New Server.
2. Retain all other default settings and click OK to create the virtual machine. The virtual machine displays in the Virtual Machines list.
转载地址:http://twxil.baihongyu.com/