VMmanager 6: Administrator guide

Preparing the OS Linux template


The OS Linux template is a RAW disk image of the operating system. The template must be stored in the repository in an .xz archive.

To prepare the OS Linux template:

  1. Create a virtual machine (VM) with the required OS version.
  2. Configure the operating system and install the necessary software packets.
  3. Stop the VM.
  4. Determine the format in which the VM disk is saved:

    qemu-img info <disk_path> | grep "file format"

    <disk_path> — path to the VM disk

  5. Copy the VM disk file to a separate directory. If the disk is not saved in RAW format, convert it to RAW format:

    qemu-img convert -f <disk_format> -O raw <disk_path> <image_path>

    <disk_format> — original disk format

    <disk_path> — path to the VM disk

    <image_path> — path to save the image

  6. Optimize the image file with virt-sparsify utility:

    LIBGUESTFS_BACKEND=direct virt-sparsify --in-place <image_path>

    <image_path> — path to the image file

  7. Clear the image of personal information with virt-sysprep utility:

    LIBGUESTFS_BACKEND=direct virt-sysprep --format=raw --operations <sysprep_ops> --add <image_path> --root-password random

    <sysprep_ops> — information to be deleted. Recommended value: defaults,ca-certificates,kerberos-data,user-account. Read more in the utility documentation.

    <image_path> — path to the image file

    --root-password random — set a random password for the root user

  8. Create an archive with the image in .xz format:

    xz <image_path>

    <image_path> — path to the image file

  9. Copy the archive to the repository directory.
  10. Add the template information to the metadata.json repository description file. Read more in OS templates repositories.
Thank you for your feedback!
Was the article useful?
Tell us why not:

it does not match the title

it was hard to understand

I didn't find the answer

recommendations from the article did not help


Tell us what you didn't like in the article: