Bookmark this page

Guided Exercise: Creating and Deploying Virtual Machines with Templates

In this exercise, you will create a template of a Red Hat Enterprise Linux virtual machine and use it to deploy a new virtual machine.

Outcomes

You should be able to create a template from an existing virtual machine (rhel-vm1) and use it to deploy a new virtual machine.

Log in to workstation as student using student as the password.

On workstation, run the lab vms-template start command. This command runs a start script that determines if the Red Hat Virtualization environment is configured and working.

[student@workstation ~]$ lab vms-template start
  1. On workstation, open Firefox and using the https://rhvm.lab.example.com URL go to your RHV-M web interface. Click on the Administration Portal link and log in to the web interface as the admin user, with the internal profile, using redhat as the password.

  2. Make sure that the rhel-vm1 virtual machine is powered down.

    1. Navigate to Virtual Machines by clicking on Compute in the menu bar, and then selecting Virtual Machines.

    2. Highlight the row containing the rhel-vm1 virtual machine by clicking an empty cell in that row. Confirm that the rhel-vm1 virtual machine has a Status of Down. To the left of rhel-vm1, you should see a single red triangle pointing downwards. If the rhel-vm1 virtual machine is not down, click the Shudown button and wait for the status to change to Down.

  3. Create a template named rhel-template from the rhel-vm1 virtual machine.

    1. With the rhel-vm1 virtual machine row highlighted, click the three vertical dots to the right of the Create Snapshot button, and then select Make Template. The New Template window opens.

    2. In the Name text field, type the name rhel-template for the template.

    3. In the Description text field, type the description RHEL 7.6 server template for the template.

    4. In the Alias text field, type the name rhel7-server for the alias.

    5. If it is not already selected, select the Seal Template (Linux only) check box.

    6. Leave the other options with their default settings. Click the OK button to create the template.

    7. Notice that the rhel-vm1 virtual machine and all of its disks are locked. You should see an hour glass icon in the row for the rhel-vm1 virtual machine. The template can take a couple of minutes to be prepared. Wait until the process of creating the template finishes. Template generation is complete when the virtual machine is released from its locked state.

  4. Create a new virtual machine named rhel-vm2, based on the template that you created.

    1. On the Compute >> Virtual Machines page, click the New button. The New Virtual Machine window displays.

    2. In the Cluster menu, choose clusterone.

    3. In the Template menu, choose rhel-template.

    4. In the Name field, type the name for the virtual machine as rhel-vm2.

    5. In the Description field, type the description for the virtual machine as RHEL Guest from a template.

    6. Notice that the network configuration matches the one from the original rhel-vm1 virtual machine, and that you are unable to create any new disk images.

    7. Leave all other options as they are. Click the OK button to deploy the new template-based virtual machine.

    8. Wait while the virtual machine is created. Once it becomes available, confirm that it is functional by starting the virtual machine and logging into it as the root user using redhat as the password.

Finish

On workstation, run the lab vms-template finish script to complete this exercise.

[student@workstation ~]$ lab vms-template finish

This concludes the guided exercise.

Revision: rh318-4.3-c05018e