This guide explains how to set up and run Labtainer, a Linux-based cybersecurity lab environment, on a MacBook Pro M3 using UTM. Labtainer is typically not available for ARM, so this setup involves emulating an x86 environment. Thanks to this guide, NPS has officially provided a QCOW2 image, allowing users to skip several setup steps.
- Overview of Tools and File Formats
- Using the Official QCOW2 Image
- Preparing the Labtainer Image Manually
- Setting Up the Virtual Machine in UTM
- Demo Video
- Additional Notes
An OVA (Open Virtualization Archive) file is a standardized file format that packages all components of a virtual machine into a single file, making it easy to share and distribute VMs. OVA files can contain the VM disk image (usually in VMDK format), configuration files, and metadata.
QCOW2 (QEMU Copy-On-Write version 2) is a disk image format used by QEMU. It supports advanced features such as snapshots, compression, and encryption, ideal for use in virtualized environments like UTM.
NPS now provides an official QCOW2 image for Labtainer based on the original instructions in this guide. This image is pre-configured for use with UTM, allowing you to skip steps 2, 3, and 4 of the manual setup.
After downloading the QCOW2 image:
- Unzip the file.
- Download and install UTM, if you haven’t already:
- UTM Download Link
- Install UTM by opening the
.dmg
file and dragging it to your Applications folder.
- Open UTM and create a new virtual machine:
- Click the + button in UTM and select Virtualize to create a virtual machine.
- Follow the wizard steps:
- System Settings: Select the architecture and assign sufficient memory (e.g., 4GB or more).
- Complete the wizard to create the VM. Do not worry about the disk settings during this step.
- After the VM is created, open its configuration settings:
- Add a new drive and select the QCOW2 file as the drive source.
- Configure networking as needed (e.g., shared or bridged).
- Save and start the VM. Refer to the YouTube tutorial if you need guidance.
If you prefer a manual setup or for learning purposes, you can prepare the image yourself by following these steps.
UTM is a virtual machine manager for macOS that supports running VMs on both x86_64 and ARM-based Macs. Download the latest version of UTM for macOS from GitHub:
After downloading, open the .dmg
file and install UTM by dragging it to your Applications folder.
Labtainer is distributed as an OVA file. Download the pre-configured Labtainer OVA image for VMware:
To convert the OVA file to a QCOW2 format compatible with UTM, we’ll need QEMU, a free and open-source emulator. Install QEMU via Homebrew:
brew install qemu
Note: Homebrew is a package manager for macOS. If you don’t have it installed, follow the instructions on Homebrew’s website.
The OVA file is essentially a compressed archive. To extract it, use the following command in your terminal:
tar -xvf LabtainerVM24a-VMWare.ova
After extracting, you should see several files, including a .vmdk
file (the virtual disk for VMware). We will convert this .vmdk
file to the QCOW2 format:
qemu-img convert -O qcow2 LabtainerVM-VMWare-disk1.vmdk labtainer-utm-vm.qcow2
This command creates a file called labtainer-utm-vm.qcow2
, which is compatible with UTM.
- Open UTM and click the + button to create a new virtual machine.
- Select Virtualize to create a virtual machine with x86_64 emulation.
For my setup on a MacBook Pro M3 with 36 GB of RAM, I used the following configuration:
-
System:
- Architecture: Set to x86_64 (even though your Mac is ARM, UTM can emulate x86).
- CPU Cores: Set to 4 cores.
- Multithreading: Enabled (recommended to improve performance).
- Boot Options: Disable UEFI Boot (uncheck this option).
-
Memory: Allocate 8 GB of RAM for the virtual machine. If you have less RAM, you may need to adjust this, but 8 GB is recommended for stable performance in Labtainers.
-
Drive: After creating the VM:
- Open the VM’s configuration settings.
- Add a new drive, select Browse, and attach the
labtainer-utm-vm.qcow2
file.
-
Display:
- Graphics Card: Select virtio-gpu-gl-pci (GPU Supported) to enable better graphical performance.
- SPICE: Ensure SPICE is selected if you need enhanced display options, such as clipboard sharing.
- Start the VM in UTM.
- Once the VM boots, log in and check that Labtainers is operational.
Additional Resources: For a visual guide on how to import a QCOW2 image into UTM, you may find this YouTube tutorial helpful.