Hello, and welcome to this presentation on creating a template from a virtual machine
in Oracle Linux Virtualization Manager.
In this video you will learn the purpose of templates and how to use them.
To demonstrate how to seal a virtual machine to be used to create a template.
How to create a template from a virtual machine using the Oracle Linux Virtualization Manager.
Lets begin with an explanation of a some key terms used regarding templates.
A template is a copy of a virtual machine that you can use to simplify the creation
of similar virtual machines.
Templates capture the hardware and software configuration of the virtual machine on which
the template was created from.
The template uses the same network interface card or NIC type and driver as the original
virtual machine, but are given their own unique MAC addresses.
Sealing a virtual machine is the process of ensuring system-specific details from an Oracle
Linux virtual machine used to create the template are not then replicated in any subsequent
VMs created from that template.
So when creating templates from existing virtual machines, you seal the virtual machine to
prevent its unique attributes from appearing on the virtual machines you later create.
Sealing of the virtual machine can be automatically performed by the Oracle Linux Virtualization
Manager as a selectable option offered in a dialog when creating a new template through
the Administration Portal.
During the process of creating the template a read only copy of the virtual machines disk
is made.
This disk is used to create any VMs built using the template.
Any new virtual machine created from the template is similar in concept to a clone of the original
VM.
Ok lets now look at creating a new template.
We will automatically seal the virtual machine, and we will see this later by selecting the
appropriate checkbox in the New Template dialog.
We are logged into the Oracle Linux Virtualization Manager Administration Portal, and viewing
the list of currently configured virtual machines.
Notice that virtual machine ol7-vm1 we want to use to create the template is in the Down
state.
It is necessary to put the VM in a Down state before using it to create a template.
To make a template, we begin by highlighting the VM we want to use in the list.
Then clicking the three dots or More Actions icon, we select Make Template from the drop
down list.
The New Template dialog box appears.
In the Name field, we enter ol7-vm1-newtemplate for the name of our new template.
In the Alias column of the Disc Allocation section, we rename the disk alias to be the
same as the template name we entered in the Name field.
Replacing Disk1 in the name with newtemplate.
To have the VM automatically sealed for us, we select the Seal Template checkbox.
Note that in brackets it states this is only available for Linux only VMs.
We click the OK button to start creating the template.
The icon beside the name of our VM now shows an egg timer and under the Status column we
a status of Image Locked while the template is being created.
The time it takes for the template to be created depends on the size of the virtual disk and
the capabilities of your storage hardware.
I have removed several minutes of the creation process from this video to shorten our wait
time.
When complete a pop up message informs us it has finished creating the template, and
the virtual machine is left in a down state.
Selecting the Compute menu and then Templates.
We see the new template is added to the list of templates available.
We can now create new Oracle Linux virtual machines that are based on this template.
For Linux systems you have the option to manually seal a virtual machine before using it to
create a template.
For simplicity, it is easier to select to automatically sealing of the VM when creating
the template in the Administration Portal dialog, and have all this taken care of.
But to manually seal it these are the commands you need to run on the VM.
Here we see two outputs showing how to manually seal a virtual machine.
They were captured from the console session with the ol7-vm1 virtual machine, where I
was logged in as the root user.
The first thing we need to do is execute the command touch /.unconfigured to flag the system
for reconfiguration.
Next, we run the command rm -rf /etc/ssh/ssh_host_* to remove the SSH host keys from the /etc/ssh/
directory.
Then, we check the host name value is set to the default of localhost.localdomain.
If not, we need to set it to the default.
On Oracle Linux 6 systems the hostname value in the /etc/sysconfig/network file.
The virtual machine from which this template will be based on is an Oracle Linux 7 system,
so to change it back to its default, we would edit the /etc/hostname file.
However, using the command cat /etc/hostname we see it is already set so we can move to
the next step.
We remove any rules created in the /etc/udev/rules.d directory by running the command rm -rf /etc/udev/rules.d/70-*.
We remove the system-specific lines, such as HWADDR (hardware MAC address) and the UUID
in the network configuration files in the /etc/sysconfig/network-scripts/ directory.
The virtual machine we are using here has only one configured interface, which is ifcfg-eth0.
For this, the only system-specific detail we need to remove is the UUID information.
Cleaning up the log history and command history items are optional steps.
You might consider cleaning up the logs from the /var/log directory and build logs from
/root directory.
We use the command rm -rf /var/log/*.* to clear out the logs in /var/log directory.
Likewise, you can also use the command history -c to clean up the command history.
When you have completed these steps, you can shutdown the virtual machine by using the
poweroff command or the Shutdown option from the graphical user interface.
The Oracle Linux virtual machine is now sealed and ready to be used to make a template.
Remember, for Linux systems you can manually seal a virtual machine before creating the
template.
But when we create the new template using the Administration Portal, we are given the
option to have the VM sealed automatically.
This sealing ensures there is no duplication of information between VMs created from the
template.
The new VMs can be considered similar to clones of the VM the template was created from.
In this video you learned the purpose of templates and how to use them.
To demonstrate how to seal a virtual machine to be used to create a template.
How to create a template from a virtual machine using the Oracle Linux Virtualization Manager.
Oracle provides an extensive number of resources which you can use to find out more about this
subject and others.
For more videos on Oracle Linux Virtualization Manager go to the learning library link shown.
To view an extensive collection of training content covering a range of administrative
topics on Oracle Linux, go to the Oracle Linux Learning Library.
You can find documentation on Oracle Linux Virtualization Manager at the link shown.
There is a comprehensive Oracle Linux curriculum available to support a full range of Linux
administration skills for cloud, on-premise and hybrid users.
For more information or to get started on Oracle Cloud Infrastructure, go to cloud.oracle.com.
And for more training on Linux on Oracle Cloud Infrastructure go to the link shown here.
Thats the end of this video, thanks for watching.