<commit_before>---
description: |
    The Qemu Packer builder is able to create KVM and Xen virtual machine images.
    Support for Xen is experimental at this time.
layout: docs
page_title: QEMU Builder
...

# QEMU Builder

Type: `qemu`

The Qemu Packer builder is able to create [KVM](http://www.linux-kvm.org) and
[Xen](http://www.xenproject.org) virtual machine images. Support for Xen is
experimental at this time.

The builder builds a virtual machine by creating a new virtual machine from
scratch, booting it, installing an OS, rebooting the machine with the boot media
as the virtual hard drive, provisioning software within the OS, then shutting it
down. The result of the Qemu builder is a directory containing the image file
necessary to run the virtual machine on KVM or Xen.

## Basic Example

Here is a basic example. This example is functional so long as you fixup paths
to files, URLS for ISOs and checksums.

``` {.javascript}
{
  "builders":
  [
    {
      "type": "qemu",
      "iso_url": "http://mirror.raystedman.net/centos/6/isos/x86_64/CentOS-6.5-x86_64-minimal.iso",
      "iso_checksum": "0d9dc37b5dd4befa1c440d2174e88a87",
      "iso_checksum_type": "md5",
      "output_directory": "output_centos_tdhtest",
      "shutdown_command": "shutdown -P now",
      "disk_size": 5000,
      "format": "qcow2",
      "headless": false,
      "accelerator": "kvm",
      "http_directory": "httpdir",
      "http_port_min": 10082,
      "http_port_max": 10089,
      "ssh_host_port_min": 2222,
      "ssh_host_port_max": 2229,
      "ssh_username": "root",
      "ssh_password": "<PASSWORD>",
      "ssh_port": 22,
      "ssh_wait_timeout": "30s",
      "vm_name": "tdhtest",
      "net_device": "virtio-net",
      "disk_interface": "virtio",
      "boot_wait": "5s",
      "boot_command":<commit_msg>Use the latest Centos 6 release<commit_after>---
description: |
    The Qemu Packer builder is able to create KVM and Xen virtual machine images.
    Support for Xen is experimental at this time.
layout: docs
page_title: QEMU Builder
...

# QEMU Builder

Type: `qemu`

The Qemu Packer builder is able to create [KVM](http://www.linux-kvm.org) and
[Xen](http://www.xenproject.org) virtual machine images. Support for Xen is
experimental at this time.

The builder builds a virtual machine by creating a new virtual machine from
scratch, booting it, installing an OS, rebooting the machine with the boot media
as the virtual hard drive, provisioning software within the OS, then shutting it
down. The result of the Qemu builder is a directory containing the image file
necessary to run the virtual machine on KVM or Xen.

## Basic Example

Here is a basic example. This example is functional so long as you fixup paths
to files, URLS for ISOs and checksums.

``` {.javascript}
{
  "builders":
  [
    {
      "type": "qemu",
      "iso_url": "http://mirror.raystedman.net/centos/6/isos/x86_64/CentOS-6.8-x86_64-minimal.iso",
      "iso_checksum": "0ca12fe5f28c2ceed4f4084b41ff8a0b",
      "iso_checksum_type": "md5",
      "output_directory": "output_centos_tdhtest",
      "shutdown_command": "shutdown -P now",
      "disk_size": 5000,
      "format": "qcow2",
      "headless": false,
      "accelerator": "kvm",
      "http_directory": "httpdir",
      "http_port_min": 10082,
      "http_port_max": 10089,
      "ssh_host_port_min": 2222,
      "ssh_host_port_max": 2229,
      "ssh_username": "root",
      "ssh_password": "<PASSWORD>",
      "ssh_port": 22,
      "ssh_wait_timeout": "30s",
      "vm_name": "tdhtest",
      "net_device": "virtio-net",
      "disk_interface": "virtio",
      "boot_wait": "5s",
      "boot_command":
{'fraction_non_alphanumeric': 0.11481683980317113, 'fraction_numerical': 0.03143794423182067, 'mean_word_length': 3.4621951219512197, 'pattern_counts': {'":': 50, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4429026', 'n_tokens_mistral': 1315, 'n_tokens_neox': 1213, 'n_words': 390}