Hello and welcome to this presentation about using the Oracle Linux KVM image for Oracle
Cloud Infrastructure.
In this video we will describe the Oracle Linux KVM Images available for Oracle Cloud
Infrastructure.
We will create an Oracle Linux KVM host instance from a Oracle Linux KVM Image.
And prepare the KVM host instance to support a KVM guest by attaching a block volume and
a secondary VNIC.
Oracle Linux KVM image is a host appliance built with Oracle Linux.
The image includes automation and tooling using utilities designed to work specifically
with Oracle Cloud Infrastructure instances, block storage, and instance secondary VNICs.
To use Oracle Linux KVM in your Oracle Cloud Infrastructure, you create an instance by
selecting one of the available KVM images offered.
There are 2 ways to accomplish this.
The first method is to create a new Instance, and when providing its parameters, you can
select from two KVM images offered.
There is the Oracle Linux KVM Image and the Oracle Linux KVM Image Autonomous Linux version.
Both are provided in the Oracle Images catalog.
The second method is to choose one of these two images offered as applications in the
Oracle Cloud Marketplace in your Oracle Cloud Infrastructure.
You select the Oracle Linux KVM Image you prefer and then click on the Launch Instance
button.
Oracle Cloud Infrastructure resource management for KVM host instances is done through the
cloud console and through command line on the KVM host.
You manage storage and network resources using the Oracle Cloud Infrastructure console and
the KVM host together.
When you need storage for the host, you attach a block volume and partition and mount the
device when it's needed.
You need to attach a block volume for each guest you want to support.
And you also need to create secondary vnics for each guest you want to support.
The KVM host automatically assigns a block volume and a vnic from those available when
you create the KVM guest.
In this video we will create a new KVM host instance and selcting the Oracle Linux KVM
image to be used from the images catalog.
We will then create and attach block storage, and a secondary VNIC.
So let's look at how this is all done.
After logging on to the Oracle Cloud Infrastructure console, we navigate to Compute, then Instances.
Then click on Create Instance to open the instance creation dialog.
We give our new instance a name, here it will be KVM-Host-192.
After selecting its Availability Domain, we scroll down to the Image section.
Clicking the Change Image button, we are presented with the images catalog.
At the top of the table we select the Oracle Images tab.
Scrolling down we change through the pages until we see the two KVM images, the Oracle
Linux KVM Image and the Autonomous Linux version.
We tick the box to select the Oracle Linux KVM Image.
At the bottom we accept the Oracle Standard Terms and Restrictions, then click Select
Image.
Scrolling down we can change the instance Shape if we wish, but we will keep the current
selection.
We select the VCN and Subnet for our instance.
We select to choose the Public key file to use, and drag and drop it into the dialog.
We keep the Boot Volume default setting.
Then click Create to begin creating the new instance.
After a some time, the instance changes from Provisioning to Running.
Now we can attach a block volume for each guest we want to support.
You can attach as many block volumes as you need ahead of time. The KVM host will allocate
them as needed and will return them to be available for reuse when the KVM guests are
destroyed.
Scrolling down we click Attached Block Volumes under Resources and see there are no block
volumes attached to this instance.
Before attaching, we need to create a block volume so we navigate to Block Storage and
then Block Volumes.
We click Create Block Volume and give it a name of KVM-guest-192-01.
We create this in availability domain three, just like with the instance.
I'll change the size to 50 GB for this volume, and click Create Block Volume.
After a few seconds the block volume is available.
Let's create another block volume, which I'll name cm-virtdoc-utility-volume.
I'm going to stage the operating system ISO image file used to create the KVM guest on
this utility volume.
Again select availability domain 3 and change the size to 50 GB.
Then click Create Block Volume.
We now have our two block volumes created, so next we need to go back to our KVM host
instance and attach the block volumes.
Navigate back to Compute and Instances again.
We select our KVM-Host-192 instance and on its details page scroll down and click Attach
Block Volume.
We select iSCSI as the Volume Attachement Type.
Then from the Block Volume dropdown, we select the KVM-guest-192-01 block volume.
Then click Attach.
I'll acknowledge the information message and close the pop up dialog box.
Next we need to run some iscsiadm commands from the command line on the KVM host instance
to connect to the block volume.
These commands are provided to us by clicking the three dots beside our attached block volume
entry.
This brings up a menu of options for the attached blocked volume.
We select the iSCSI Commands & Information option from the menu.
Here we see the iscsiadm commands provided to us to connect and to disconnect from our
block volume.
Beside the Commands for Connecting box click the Copy link to copy all the commands to
clipboard.
Now we can switch to a terminal window where I'm logged on to the KVM host instance.
And we paste the copied iscsiadm commands and press enter.
Now if we run the command sudo fdisk -l, this block volume is recognized by the operating
system.
Let's go back to the Oracle Cloud Infrastructure console and attach the 2nd block volume.
After clicking Attach Block Volume again, we select iSCSI as the Volume Attachement
Type.
And choose the cm-virtdoc-utility-volume from the Block Volume drop down, and then Attach.
We acknowledge the info message, and close the dialog box.
We wait for the second volume to attach, then open the iSCSI Commands and Information.
And copy the iscsiadm commands to connect the volume.
Again we switch back to the terminal window on the KVM host instance.
Let's run the clear command to give us a clear window, and then paste the copied iscsiadm
commands, and press enter.
Running the command sudo fdisk -l, we see that this second block volume is recognized
by the operating system.
In addition to creating and attaching block volumes through the console and with iscsiadm
commands, we can also use oci-utils commands to create and attach volumes from the command
line.
Here on our terminal to our host we have already attached two volumes created through the console.
We can create a new volume of 50 gigabytes and attach it from our host terminal using
the command sudo oci-iscsi-config --create-volume 50 --volume-name kvm-guest-192-vol3.
with a single command we create the new block volume from our cloud resources and have it
attached to our KVM host.
And we can see the volume was created and attached.
Using the command fisk -l we can see the new volume now available to us.
Going back the console, we are looking at our instance details.
Scrolling down and clicking on Attached Block Volumes under Resources.
We can see the new volume created from the command line attached to our instance now.
Note that in order for the instance to request to create a new volume from cloud resources,
authentication keys need to be created and uploaded to the users cloud profile.
This process is not part of this video.
With our block volumes attached, we will now create a secondary vnic for each guest you
want to support.
Back on our console, and still looking at the details of our instance, under Resources
we select Attached VNICs.
We see the primary VNIC attached as a result of creating our instance.
So to create a secondary VNIC we click the Create VNIC button.
We name our secondary VNIC kvmguest01.
And we select the same VCN used for our instance, which is VCN-192.
Scrolling down, we select the VCN subnet VCN-192-03.
And then click Save Changes.
Our secondary VNIC now appears in the list of attached VNICs, and after some time will
show as attached.
We need to run a script from the docs.cloud.oracle.com site to configure the operating system for
Secondary VNICs.
So lets's switch back to our terminal window on the KVM host instance and view the VNICS
with the command ip a.
Our secondary VNIC appears with the name ens4 but doesn't have an IP address.
In this demonstration, I've already downloaded and named the script add_vnic.sh.
Running the ls command we see the script.
So I run the command, sudo add_vnic.sh -c to configure the secondary VNIC.
Showing the result that an IP address has been set for our secondary VNIC ens4.
Now if we run the ip a command again to view the network configuration, our secondary VNIC
has an IP address.
Like with block volumes we can use an oci-utils command to create a new vnic for our instance
but from the command line.
With root level privileges to do this, we can use the command oci-network-config --create-vnic
--vnic-name new-vnic3.
Remember that to do this, the hardware shape for you instance must have the available resources
to allow additional vnics be created.
Oracle provides an extensive number of resources which you can use to learn more about this
subject and others.
Look for additional videos on the Oracle Linux KVM image on the Oracle Linux Learning Library.
And see the education.oracle.com links for a comprehensive Oracle Linux curriculum available
to support a full range of Linux administration skills for cloud, on-premise and hybrid users.
Thats the end of the video.
Thanks for watching.