"

12 Create QEMU Images

Mathew J. Heath Van Horn, PhD

Quick Emulator (QEMU) is a free and open-source emulator that works with hardware near-native speeds.  It has many advantages in that QEMU machines can run on various host operating systems.

Learning Objectives

  • Install QEMU on Windows
  • Convert a VirtualBox VM to QEMU
  • Import the QEMU image into GNS3

Prerequisites

  • Install VirtualBox
  • Install GNS3

Deliverables

  • None – This is for student needs

Resources

contributors and testers

Testers:

 

Phase I – Install QEMU

These are the instructions to install QEMU on your local machine.  QEMU uses CLI for its user interface.

  1. Visit this website and download the QEMU Binary for Windows
  2. Double-click on the downloaded file and install the program
    1. Select your language (Figure 1)
    2. Press Next on the welcome screen (Figure 2)
    3. Review and agree to the license agreement (Figure 3)
    4. Accept the default components and press next (Figure 4)
    5. Use the default path and click install (Figure 5)
    6. When completed, click on Finish (Figure 6)
  3. Add QEMU to the command line path of Windows
    1. Navigate to the folder where you installed QEMU and copy the file path. On Windows the default is C:\Program Files\qemu  (Figure 7)
    2. Right-click on Start, then settings
    3. In the search box type [environment] and click on Edit the system environment variables (Figure 8)
    4. Click on Environment Variables (Figure 9)
    5. Click on Path, then click Edit (Figure 10)
    6. Click on New
    7. Paste the path that you copied earlier (Figure 11)
    8. Press OK to accept the changes and then exit all of the open windows

 

Phase II – Create the QEMU image

QEMU images can be created from ISOs using the command line.  However, our testers found creating VMs in Oracle VM VirtualBox Manager the easiest way.  Then use the manager tools to convert the VirtualBox VMs to an intermediate format.

  1. Select an existing VM from the Oracle VM VirtualManager.  We are going to use a Kali VM for this walk-through
  2. Right-click on the image and select Export to OCI (Figure 12)
  3. Format Settings (Figure 13)
    1. Select OVF 2.0 format

      NOTE: You might get a cloud error since the default configuration option is cloud and you probably have not configured the cloud settings. Press the ‘X’ to dismiss the message.

    2. Select the file location where you want the export
    3. Select Include all network adapter MAC addresses
    4. Select Write Manifest file

      NOTE: The Manifest file is used for error checking during the export/import process.

    5. Select Include ISO image files

      NOTE: The ISO files are not necessarily needed and produce a larger file export.  However, by including the ISO file, if something is missing from the OS VM the missing program or option can quickly be added.  Think Windows optional programs.

    6. Click Next
    7. Click Finish (Figure 14)
    8. The export process can take a bit of time.  Only export one VM at a time
      Sleeping 0
      Figure Zzzzzz – This could take a while

      NOTE: QEMU cannot directly convert an OVA file to the qcow2 format because OVA is a tar-compressed file and so we must extract all the compressed files first.

  4. In Windows File Explorer, navigate to the location where the export was created and use 7zip to extract here (figure 15)

    NOTE: 7zip occasionally gives a warning Unexpected End of Data.  You can close the extraction window, everything is fine.

  5. You should now see a VMDK file with an appended -disk001 in the folder (Figure 16)
  6. Within the folder, right-click on the background and select open in terminal to open the CLI
  7. Convert the VMDK file to a QEMU format called QCOW2, by typing all on one line (Figure 17)

    qemu-img convert -f vmdk -O qcow [source_file_name].vmdk [destination_file_name].qcow2

 

NOTE: The conversion can also take a while.

 

Phase III – Add the QEMU to GNS3

Running VMs in QEMU mostly runs faster and with fewer problems.  With one exception; Windows runs better in VirtualBox.  Here is where we add the QEMU images to GNS3.

  1. Start GNS3 and wait for the lights to turn green
  2. In preferences, click on Qemu VMs
  3. Click New (Figure 18)
  4. Select Run the Qemu VM on the GNS3VM (Figure 19)
  5. Click Next
  6. Name the Qemu VM, in this case, we are calling it Kali (Figure 20)
  7. Leave the Qemu binary on the default, and make sure the VM has enough RAM (Figure 21)
  8. Click Next
  9. Change the console type to VNC to use the GUI interface and click Next (Figure 22)
  10. Click on New Image (Figure 23) and browse to the location where we saved our Qemu image (QCOW2) of Kali (Figure 24)
  11. After it finishes loading, click Finish
  12. Click Apply (Figure 25)

 

Figures

 

Figure 1
Figure 1
Figure 2
Figure 2
Figure 3
Figure 3
Figure 4
Figure 4
Figure 5
Figure 5
Figure 6
Figure 6
Figure 7
Figure 7
Figure 8
Figure 8
Figure 9
Figure 9
Figure 10
Figure 10
Figure 11
Figure 11
Figure 12
Figure 12
Figure 13
Figure 13
Figure 14
Figure 14
Figure 15
Figure 15
Figure 16
Figure 16
Figure 17
Figure 17
Figure 18
Figure 18
Figure 19
Figure 19
Figure 20
Figure 20
Figure 21
Figure 21
Figure 22
Figure 22
Figure 23
Figure 23
Figure 24
Figure 24
Figure 25
Figure 25

License

Create QEMU Images Copyright © 2024 by Mathew J. Heath Van Horn, PhD. All Rights Reserved.