Skip to Main Content

Infrastructure Software


For appeals, questions and feedback about Oracle Forums, please email Please ask technical questions in the appropriate category. Thank you!

Getting Started: Oracle Linux KVM Image for Oracle Cloud Infrastructure

Julie Wong-OracleApr 25 2018 — edited Nov 20 2019


This Getting Started guide outlines the steps to easily and quickly create virtual machines using the packaged tools provided by the Oracle Linux Kernel-based Virtual Machine (KVM) image for Oracle Cloud Infrastructure (OCI). KVM provides a set of modules that enable you to use the Oracle Linux kernel as a hypervisor and is built into the Oracle Linux Unbreakable Enterprise Kernel (UEK) by default.

Oracle Linux KVM is available for deployment from the Oracle Cloud Marketplace and the OCI Oracle Images catalog. This Oracle packaged image simplifies the deployment of virtual machines (VMs) by integrating with services such as block storage and virtual network interfaces through the use of scripted tools, including oci-utils. These tools include support for defining the VM guest domain, allocating a specific block device or VNIC and launching and removing VMs on Oracle Cloud Infrastructure.

What’s New

Release 1.5

  • Updated base OS to Oracle Linux 7.7
  • Support for OCI AMD bare metal (BM) shapes
  • Support for nested virtualization on OCI Intel based virtual machine (VM) shapes
  • New KVM utilities for Oracle Cloud Infrastructure provided in this release are:
    • oci-kvm create-network
      • Creates a VNIC virtual network for a KVM guest. Creates a bridged libvirt network on top of a VNIC, allowing a single VNIC to be shared among multiple guests.
    • oci-kvm delete-network
      • Deletes a VNIC virtual network for a KVM guest.
    • oci-kvm create-storage-pool
      • Creates, mounts and configures a file system on a block storage device or storage allocated on the Oracle Cloud File Storage Service on Oracle Cloud Infrastructure. Enables the use of a single block disk to host several guest disks.

Release 1.4

  • Support for VNIC creation via oci-network-config --create-vnic
  • Support for block device creation via oci-iscsi-config --create-volume
  • Virtual Function network interfaces are now fully configured using the native Oracle Linux systemd LSB networking (ifcfg network configuration files)
  • Updated to oci-utils version 0.6
  • Updated to the Oracle Linux 2018-05-08 base image


If you are new to Oracle Cloud Infrastructure, review the Getting Started section in the Oracle Cloud Infrastructure documentation.To use the Oracle Linux KVM image, it must be deployed on an Oracle Cloud Infrastructure Compute instance. The following OCI compute shapes are supported (list and specifications subject to change without notice):

  • BM.Standard2.52 - 2.3 GHz Intel® Xeon® E5-2699 v3
  • BM.Standard.E2.64- 2.0 GHz AMD EPYC 7551
  • BM.DenseIO2.52 - 2.0 GHz Intel® Xeon®Platinum 8167M
  • VM.Standard2.*- 2.0 GHz Intel® Xeon® Platinum 8167M
  • VM.DenseIO2.* - 2.0 GHz Intel® Xeon®Platinum 8167M

Familiarity with managing virtual machine guests using libvirt, in particular virsh and virt-install, is helpful.

Creating an Oracle Linux KVM Instance

Method 1: Click to Launch using the Oracle Cloud Marketplace

Oracle Cloud Infrastructure provides ready access to the Oracle Linux KVM image for fast and easy deployment using the embedded Marketplace in OCI. You can launch Oracle Linux KVM instances directly from the Marketplace on your Oracle Cloud Infrastructure Compute instance. The fastest method to deploy the Oracle Linux KVM Image on OCI is using the embedded Marketplace in OCI. With a few easy clicks, you can get your Oracle Linux KVM instance up and running.

Follow the instructions below to launch a KVM instance using the Marketplace in OCI:

1. Login to your OCI console. To access the Marketplace from the OCI Console, click on the top left navigation menu. Then, under Solutions and Platform, go to Marketplace.

2. Under the Category filter, select Operating Systems. Select the Oracle Linux KVM Image application from the Marketplace.


3. The Oracle Linux KVM Image page displays overview details about the application, and provides useful links to documentation and resources, and usage information on how to access the KVM instance on OCI. Select the Version of the image, the Compartment in which you wish to deploy the image, and accept the Oracle Standard Terms and Restrictions. Click on the Launch Instance button.


4. Select the version of the image and the compartment in which you wish to deploy the image, and accept the terms of usage. Click on the Launch Instance.

5. The Create Compute Instance window is automatically pre-populated with the KVM image source and instance configuration details. You may modify any instance configuration details in this window:

Launch the KVM instance with the following options:

  • Choose instance type: Select Virtual Machine or Bare Metal Machine
  • Choose instance shape: Click on Change Shape and select the compute shape to deploy the image on.
  • Add SSH Keys: You must provide the SSH Keys information.
  • Configure networking: Configure your Virtual Cloud Network information.

Click on Create Instance to immediately deploy your KVM instance.

Get Started Create 1.JPG

**Method 2: Creating the Instance from OCI Provided Oracle Images (Image Catalog)

Use the following instructions to create a KVM instance from the Oracle Images Catalog in OCI.

  1. Login to your Oracle Cloud Infrastructure account.
  2. From the Main Menu, under Core Infrastructure, go to Compute, select Instances, and click on Create Instance to provision the KVM instance. You may also select Create a VM instance under Quick Links from the OCI home page to navigate to the Create Instance page.
  3. Launch the KVM instance with the following options:
    • Choose an operating system or image source: Click on Change Image Source, and under the Oracle Images category, select Oracle Linux KVM Image. Confirm that you have reviewed and accept the Oracle Standard Terms and Restrictions. Click on Select Image.


  • Choose instance type: Select Virtual Machine or Bare Metal Machine

  • Choose instance shape: Click on Change Shape and select the compute shape to deploy the image on.

  • Add SSH Keys: You must provide the SSH Keys information.

  • Configure networking: Configure your Virtual Cloud Network information

    1. Click on Create.

For more information, go to:

Accessing the Oracle Linux KVM Instance

Connect to the newly provisioned Oracle Linux KVM instance by using an SSH client to access its public IP address. For example:

$ ssh –i <private key> <username>@<public-ip-address>

When you’re logged in as the default user, opc, you can use the sudo command to run administrative tasks.

Preparing to Create a New Virtual Machine

Prior to creating a new virtual machine, take note of what resources are required:

  • Number of CPUs
  • Amount of memory
  • Size of the root disk
  • Subnet

Each guest requires a dedicated OCI block storage device and OCI VNIC to be configured on Oracle Cloud Infrastructure console:

To allocate block storage:

  1. From the Main Menu, under Core Infrastructure, go to Block Storage, Block Volumes, and select Create Block Volume to create your block volumes.


  2. Go to your KVM instance from the Compute tab, and select Attached Block Volumes and click on Attach Block Volume to attach your block volumes as necessary.


See for more information.

To allocate a VNIC:

  1. Go to the Compute tab and select your KVM instance.
  2. Select Attached VNICs and click on Create VNIC to configure your VNIC.


See for more details.

Selecting a Storage Device and VNIC (Optional)

You can select a block storage device for your VM:

  1. Run the 'oci-iscsi-config --show' utility to show details for all attached storage attached to your instance.
  2. Choose a device and note the 'Attached device' name.
  3. Add '/dev/' in front of the device name to get the device path (e.g. /dev/sdb)

You can also choose a specific VNIC for your VM:

  1. Go to the KVM instance on the OCI console and inspect the VNIC configuration for the instance.
  2. Choose an appropriate VNIC and note the private IP address

Installing a Virtual Machine

The oci-kvm tool provided with the Oracle Linux KVM image for OCI allows you to create and configure KVM guests on OCI instances that use OCI resources such as block volumes and VNICs. The oci-kvm tool can also remove and deconfigure all system resources assigned to the guest VM and make them available for re-use.

oci-kvm (1) can be used with the following options: -D/--domain, -d/--disk, -n/--net, and -V. The -D/--domain option is required, and specifies the name of guest being created. If a particular block storage device is desired, specify -d/--disk along with the path to the device. If a particular VNIC is desired, specify -n/--net along with the private IP address of the desired VNIC. Every argument that appears after the -V option is provided directly to virt-install(1).

By default, oci-kvm(1) will choose a block storage device and a VNIC and assign both to a virtual machine automatically when there is only one VNIC and one block storage device available. This is also the case where there are multiple VNICs or block storage devices but they are functionally identical, such as when all block storage devices are the same size or all VNICs are on the same subnet. You may also explicitly choose a specific block storage device or VNIC if desired when multiple block volumes and VNICs are available.

The synopsis for oci-kvm is as follows:

  • oci-kvm create -D|--domain NAME [-d|--disk DISK_PATH ] [-n|--net IP ] -V|--virt VIRT-INSTALL_ARGS
  • oci-kvm destroy -D|--domain NAME

Refer to the oci-kvm man page for more details.

An example of an invocation is as follows:

# oci-kvm create -D my_guest -V --vcpus 4 --memory 8192 --boot cdrom,hd --location /mnt/OracleLinux-R7-U4-Server-x86_64-dvd.iso --nographics --console pty,target_type=serial --console pty,target_type=virtio --noautoconsole --os-variant=rhel7 --extra-args "console=tty0 console=ttyS0,115200n8 serial"

This example creates an Oracle Linux 7.4 guest, configured to use a serial console for console output. It is also possible to use other options, such as VNC for console output. If a graphical option is used, it will be necessary to appropriately configure the OCI Security List for the subnet this image is attached to.

Removing a Virtual Machine

Prior to removing a virtual machine, it must first be stopped. To stop a running virtual machine, issue:

virsh destroy <guest>

Once the VM has stopped, it can be permanently destroyed by issuing:

oci-kvm destroy -D <guest>

Invoking this command will undefine the virtual machine in libvirt as well as clean up any host resources that were created for it. The OCI resources that were allocated to the virtual machine are then made available for re-use by new VMs.

Additional Notes

  • On shapes that have an active physical NIC 1, attaching a KVM guest to VLAN 0 is currently not supported (it is fully supported to attach KVM guests to the other VLANs on either physical NIC)

For more information visit:

Post Details
Added on Apr 25 2018