In this review, you install a new virtual machine. Once installed, you create and use templates to deploy additional virtual machines.
Outcomes
You should be able to:
Install a virtual machine manually.
Create a template.
Install a virtual machine from a template.
Log in as the student user on workstation and run the lab vms-cr start command.
This command ensures that the RHV environment is setup correctly by configuring the RHV-H hosts, networks, storage, and disk images appropriately.
[student@workstation ~]$lab vms-cr start
Instructions
Create two virtual machines and a template according to the following specifications.
Make sure the virt-viewer package is installed on workstation.
The password for student is student.
Use this password to gain the administrative privileges that have been pre-configured.
Create a new Red Hat Enterprise Linux virtual machine named rh1 in cluster1 using Kickstart.
Use the Red Hat Enterprise Linux 7.6 boot ISO image.
A Kickstart answer file has been provided at http://materials.example.com/static/small-7.6.cfg.
Remember that you can use the RHV-M Administration Portal to access the console of the virtual machine.
The URL for the Administration Portal is https://rhvm.lab.example.com.
The rh1 virtual machine should use a new disk image of 3 GiB in size.
The maximum memory for rh1 should be 512 MB with the Instance Type as Tiny.
The rh1 virtual machine should be optimized to run as a server.
The first NIC of rh1 should be associated with the ovirtmgmt logical network.
The second NIC of rh1 should be associated with the virtual logical network.
The Kickstart installation of rh1 sets the password of the local root user to redhat.
Use the rhel-server-7.6-x86_64-boot.iso as the bootable media while invoking the Kickstart installation of rh1.
Ensure that the qemu-guest-agent package is installed on rh1 and that the qemu-guest-agent service is enabled.
You have been provided with a package repository that contains the guest agent software.
The file available at http://materials.example.com/yum.repos.d/rhel_dvd.repo gives you repository configuration to enable this package repository in rh1.
Create a template named rh-template based on the rh1 virtual machine.
Make sure to seal the template and use rhel-cr as the disk alias for the template.
Using the rh-template template, create a new virtual machine named rh2 in cluster1 cluster.
On workstation, install virt-viewer.
[student@workstation ~]$sudo yum install virt-viewer[sudo] password for student:student...output omitted...Is this ok [y/d/N]:y...output omitted... Complete!
Create a new Red Hat Enterprise Linux virtual machine named rh1 in cluster1.
Use the Red Hat Enterprise Linux 7.6 boot ISO image, created at the start of this exercise.
A Kickstart answer file has been provided at http://materials.example.com/static/small-7.6.cfg.
Remember that you can use the Administration Portal to access the console of the virtual machine.
Create a 3 GiB disk image for this virtual machine.
Specify the Instance Type as Tiny, and set 512 MB as the maximum memory of the virtual machine.
Select Server as the value of the Optimized for field of the rh1 virtual machine.
Associate the virtual machine's first NIC with the ovirtmgmt logical network.
Associate the virtual machine's second NIC with the virtual logical network.
Log in to the RHV-M Administration Portal as admin from the internal profile, using redhat as the password.
The URL for the Administration Portal is https://rhvm.lab.example.com.
From the menu, navigate to → to access the Compute >> Virtual Machines page.
In the Compute >> Virtual Machines page, click to create a new virtual machine. The window titled New Virtual Machine displays. In the New Virtual Machine window, under the General section, set the values of the fields according to the following table.
| Field | Value |
|---|---|
| Cluster | |
| Template | |
| Operating System | |
| Instance Type | |
| Optimized for | |
| Name | rh1 |
In the New Virtual Machine window, click near to Instance Images.
The window titled New Virtual Disk displays.
In the New Virtual Disk window, specify 3 as the value of the Size (GiB) field.
Leave all the other fields with their default values, and click to confirm creating the virtual disk of 3 GiB in size for the rh1 virtual machine.
In the New Virtual Machine window, under the General section, click the drop-down menu for .
From the menu that appears, select to associate the first NIC of rh1 with the ovirtmgmt logical network.
In the New Virtual Machine window, under the General section, click the + button that is displayed in the same row as .
A second row displays with the drop-down menu.
Click on the drop-down menu for , and select to associate the second NIC of rh1 with the virtual logical network.
In the New Virtual Machine window, click on Show Advanced Options and navigate to the System section.
Change the value of the Maximum memory field to 512 MB.
Click to confirm your intention to create the virtual machine with the defined properties.
Selecting an instance type populates memory and CPU values for the virtual machine. These values are visible from the System tab when viewing advanced options. Although choosing either Server or High Performance from the Optimized for menu will switch the Instance Type menu back to Custom, the memory and CPU values for the instance type that you selected will remain the same.
Modify the parameters of rh1 to use the rhel-server-7.6-x86_64-boot.iso as the bootable media at its next boot, and invoke the Kickstart installation of rh1.
Use the answer file available at http://materials.example.com/static/small-7.6.cfg for the Kickstart installation.
Click on the row for the rh1 virtual machine.
Click on the drop-down menu next to the button.
From the menu that displays, select .
The window titled Run Virtual Machine(s) displays.
In the Run Virtual Machine(s) window, click the + sign next to Boot Options.
Select the check box next to Attach CD to use the displayed rhel-server-7.6-x86_64-boot.iso file as the bootable media for rh1.
Selecting this check box inserts the ISO file into the virtual CD-ROM/DVD-ROM drive of rh1.
Under Predefined Boot Sequence, select CD-ROM and click to bring CD-ROM to the top of the list.
Click to confirm the changes you made, and to boot the rh1 virtual machine.
Wait until the button becomes active.
With the rh1 virtual machine selected, click to access the console of rh1.
The Opening console.vv window opens and prompts for your confirmation to open the connection file (console.vv).
Click to open the console.vv file using Remote Viewer.
Wait until the installer menu displays in the console of rh1.
If Remote Viewer prompts for your confirmation to inhibit shortcuts, click .
From the installer menu that is displayed in the console of rh1, highlight the and press Tab to edit the installer options.
The editor opens with the cursor automatically positioned at the end of the existing kernel arguments.
At the end of the kernel command line, add a space and the argument inst.ks=http://materials.example.com/static/small-7.6.cfg to specify the location of the answer file to use for the Kickstart installation.
Press Enter to start the Kickstart installation of the rh1 virtual machine.
Watch for the installation to complete. After the installation completes, the virtual machine automatically reboots from the CD-ROM drive. Press an arrow key to interrupt the timer for preventing the installer to invoke the installation process.
Close the console of the rh1 virtual machine.
Right-click on the row for the rh1 virtual machine, and select .
The window titled Power Off Virtual Machine(s) displays.
In the Power Off Virtual Machine(s) window, click to confirm your intention of powering down the virtual machine.
Verify that the qemu-guest-agent package is installed on the rh1 virtual machine.
Start the qemu-guest-agent service in rh1.
Use the file located at http://materials.example.com/yum.repos.d/rhel_dvd.repo to enable the package repository that provides the qemu-guest-agent package.
In the Compute >> Virtual Machines page, select the rh1 virtual machine, and click .
Wait for the value of the Status field to transition from Wait For Launch to Up with Powering Up in between.
After the virtual machine is started, click to access the console of rh1.
The Opening console.vv window opens and prompts for your confirmation to open the connection file (console.vv).
Click to open the console.vv file using Remote Viewer.
If Remote Viewer prompts for your confirmation to inhibit shortcuts, click .
Log in to rh1 as root with the password redhat.
Download the repository configuration file from http://materials.example.com/yum.repos.d/rhel_dvd.repo as /etc/yum.repos.d/rhel_dvd.repo.
[root@rh1 ~]#curl http://materials.example.com/yum.repos.d/rhel_dvd.repo \-o /etc/yum.repos.d/rhel_dvd.repo
The shell prompts that you see may vary from the book.
Use yum to verify the package repository on rh1.
[root@rh1 ~]#yum repolistLoaded plugins: product-id, search-disabled-repos, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. repo id repo name status rhel_dvd Remote classroom copy of dvd 5,152 repolist: 5,152
Use yum to verify that the qemu-guest-agent package is installed on rh1.
[root@rh1 ~]#yum list installed qemu-guest-agentLoaded plugins: product-id, search-disabled-repos, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. Installed Packages qemu-guest-agent.x86_64 10:2.12.0-2.el7 @rhel_dvd
Use systemctl to restart the qemu-guest-agent service in rh1.
[root@rh1 ~]#systemctl restart qemu-guest-agent.service
Use systemctl to verify that the qemu-guest-agent service is active and enabled in rh1.
[root@rh1 ~]#systemctl status qemu-guest-agent.service● qemu-guest-agent.service - QEMU Guest Agent Loaded: loaded (/usr/lib/systemd/system/qemu-guest-agent.service;enabled; vendor preset: enabled)Active: active (running)since Tue 2019-09-10 12:04:22 UTC; 4s ago ...output omitted...
Log out from the rh1 virtual machine.
Close the console of the rh1 virtual machine.
Create a template named rh-template based on the rh1 virtual machine.
In the RHV-M Administration Portal, navigate to the → to access the Compute >> Virtual Machines page.
In the Compute >> Virtual Machines page, right-click on the row for the rh1 virtual machine and select .
The window titled Power Off Virtual Machine(s) displays. In the Power Off Virtual Machine(s) window, click to power down the virtual machine.
With rh1 selected, click on the three vertical dots next to the button.
From the menu that displays, select .
The window titled New Template displays.
In the New Template window, enter rh-template as the value of the Name field.
Select the Seal Template (Linux only) check box.
Change the value of the Alias column under Disk Allocation to rhel-cr.
Leave all the other fields with their default values, and click to confirm your intention of creating the template.
Navigate to and search for the event containing the Creation of Template rh-template from VM rh1 has been completed. message.
It may take a couple of minutes for this message to display.
This message confirms that the rh-template template was successfully created.
In the cluster1 cluster, create a new virtual machine named rh2 using the rh-template template you created previously.
From the menu, navigate to → to access the Compute >> Virtual Machines page.
In the Compute >> Virtual Machines page, click to create a new virtual machine.
The window titled New Virtual Machine displays.
In the New Virtual Machine window, under the General section, select for the Cluster field.
Select for the Template field.
Enter rh2 as the value of the Name field.
Leave all the other fields with their default values, and click to confirm creating the new virtual machine based on rh-template.
Navigate to and search for the event containing the VM rh2 creation has been completed. message.
It may take a couple of minutes for this message to display.
This message confirms that the rh2 virtual machine was successfully created.