1. Install vmlab and validate a lab

Get the CLI running, write a minimal vmlab.wcl, and let vmlab validate check it.

After this lesson you can

- Install the vmlab binary and verify it runs - Declare a lab: one segment, one VM booting a registry template - Validate the file before ever booting it

vmlab ships as one binary plus your vmlab.wcl. Build it from source (cargo install --locked --path . in a clone of the repo) and confirm vmlab --version prints a version. The only host requirement is /dev/kvm — no bridges, no root.

A lab file is WCL: import <vmlab.wcl> brings in the schema, then a single lab block declares segments and VMs. The template below is an OCI registry ref, so you don't need to build anything first — the disk is pulled on first up. vmlab validate checks the whole model (schema, refs, subnets, dependency cycles) and is the habit to build: validate after every edit, before every up.

§ 1Exercise: A first checked lab

Write a one-VM lab in an empty directory and validate it.

wcl
// vmlab.wcl — the whole lab.
import <vmlab.wcl>

lab "hello" {

  segment "lan" {
    subnet = "10.81.0.0/24"
    nat    = true                                  // guest egress for the pull
    forward { host_port = 12222 to = "alp:22" }    // host SSH → guest 22
  }

  vm "alp" {
    template = "ghcr.io/vmlabdev/vmlab-templates/alpine-3.23"
    arch     = "x86_64"
    memory   = 1GiB
    nic { segment = "lan" }
  }
}

Expected result

vmlab validate reports the lab as valid — one segment, one VM, no errors.

Hint

Every nic must name a declared segment (or set nat = true directly). Misspell lan in the nic block and validate points at exactly that line.