virt-install is a command-line tool for creating new virtual machines through the libvirt management API, most often on KVM and QEMU hosts running Linux. In virtualization, it turns a single command with options for CPU, memory, disks, network and installation media into a complete libvirt domain definition, then starts the guest and its operating system installer.
The tool belongs to the virt-manager project and is packaged on most distributions as virt-install or within virtinst. Because the whole machine is described in one command, virt-install is the standard choice for scripted, repeatable provisioning on servers that have no graphical desktop.
How virt-install creates a virtual machine
virt-install creates a virtual machine by translating command-line options into libvirt domain XML, defining that domain through the libvirt daemon and booting it with the selected installation method. It does not run the guest itself: QEMU performs the emulation, KVM provides hardware acceleration and libvirt manages the lifecycle.
A typical run follows these steps. virt-install connects to a hypervisor URI such as qemu:///system, applies operating system defaults from the libosinfo database, allocates or attaches storage, generates the XML, starts the guest and optionally opens a console. With --print-xml it only prints the definition, which is useful for review and version control.
The table below shows how responsibilities are divided among the components involved.
| Component | Role | Example |
|---|---|---|
| virt-install | Builds the definition and starts installation | virt-install --name web01 |
| libvirt | Stores and manages the domain | libvirtd or virtqemud daemon |
| libosinfo | Supplies recommended guest defaults | --osinfo debian12 |
| QEMU | Emulates devices and runs the guest | qemu-system-x86_64 process |
| KVM | Provides hardware-assisted execution | /dev/kvm kernel module |
Essential virt-install options
The core options of virt-install describe the identity, resources, storage, network and installation source of the new guest. Most other settings receive sensible defaults, especially when the guest operating system is declared with --osinfo, which recent versions require or warn about when it cannot be detected.
The following table lists the options used in nearly every invocation, with realistic values.
| Option | Purpose | Example value |
|---|---|---|
--name | Unique domain name | db01 |
--memory | Guest RAM in MiB | 4096 |
--vcpus | Number of virtual CPUs | 2 or sockets=1,cores=4 |
--disk | Storage volume and bus | size=40,bus=virtio,format=qcow2 |
--network | Virtual network or bridge | bridge=br0,model=virtio |
--osinfo | Guest operating system identifier | rhel9.4 or detect=on |
--graphics | Display type | spice or none |
--boot | Firmware and boot order | uefi |
Using Virtio devices for disks and network interfaces gives the best performance, because paravirtualized drivers avoid the overhead of emulating legacy hardware. The --cpu host-passthrough option exposes the full host CPU model to the guest, at the cost of making live migration harder between different processors.
Installation methods supported by virt-install
virt-install supports several installation sources, from interactive ISO installers to fully unattended cloud images. The right method depends on whether a human watches the installation and whether the guest must be built from scratch.
| Method | Option | Best suited for |
|---|---|---|
| Local ISO image | --cdrom /path/image.iso | Interactive desktop or server installs |
| Network tree | --location URL | Text installs with kernel arguments |
| Kickstart or preseed | --initrd-inject with --extra-args | Unattended Fedora, RHEL or Debian installs |
| Existing disk image | --import | Prebuilt or cloned images |
| Cloud image | --cloud-init | Fast provisioning with user data |
| Network boot | --pxe | Data centers with PXE servers |
| Built-in unattended | --unattended | libosinfo-driven automatic installs |
The --location method is especially valuable on headless servers because it allows --extra-args 'console=ttyS0', which sends the installer output to a serial console reachable through virsh console. The --cdrom method cannot pass kernel arguments in this way.
virt-install compared with related virtualization tools
virt-install is a creation tool, while its neighbors in the libvirt ecosystem focus on management, disk handling or graphical interaction. Understanding the division prevents misuse, such as expecting virt-install to start or stop existing guests.
| Tool | Interface | Main task |
|---|---|---|
| virt-install | Command line | Defining and installing new guests |
| virsh | Command line shell | Managing existing domains and networks |
| virt-manager | Graphical desktop | Creating and operating guests visually |
| qemu-img | Command line | Creating and converting disk images |
| GNOME Boxes | Graphical desktop | Simple personal virtual machines |
| Quickemu | Shell scripts | Quick desktop guests without libvirt |
After creation, day-to-day operations move to virsh or virt-manager. A related utility, virt-clone, duplicates an existing guest, and virt-xml edits the definition of an existing domain with the same option syntax as virt-install.
Common mistakes when using virt-install
Most virt-install failures come from permissions, missing virtualization support or mismatched URIs rather than from the tool itself. The table below links frequent symptoms to their causes and fixes.
| Symptom | Likely cause | Fix |
|---|---|---|
| Guest runs very slowly | KVM unavailable, pure emulation | Enable VT-x or AMD-V and load kvm modules |
| Guest missing in virt-manager | Created under qemu:///session | Use --connect qemu:///system |
| Permission denied on ISO | QEMU user cannot read the file | Move image to /var/lib/libvirt/images |
| No console output | Installer uses graphical display | Use --location with serial arguments |
| Warning about missing OS | No --osinfo value given | Specify the libosinfo short ID |
A further risk is overcommitting host resources. virt-install does not prevent assigning more memory or vCPUs than the host can sustain, so administrators should plan capacity and consider features such as Kernel same-page merging only after measuring their effect.
In everyday language
virt-install is like an order form for a new computer that exists only in software. You write down the name, the memory and the storage it needs. You add the network and the installation disc. Then the tool builds the machine and switches it on.
The whole order fits in one line of text. You can save it and repeat it whenever you need an identical machine. Administrators who manage servers remotely like this. They prefer typing a command to clicking through windows.
Seen in the real world
A systems administrator at a regional hospital must provide twelve identical test servers for a new records application on a single KVM host with 128 GB of RAM. Clicking through a graphical wizard twelve times would be slow and error-prone.
The administrator writes one shell loop that calls virt-install with --memory 8192, --vcpus 4, a 60 GB qcow2 disk on Virtio, a bridged network interface and --location pointing to an internal RHEL mirror. A kickstart file injected with --initrd-inject answers every installer question, and --graphics none keeps all output on the serial console.
All twelve guests finish installing in about twenty-five minutes without any manual input. The same script is stored in version control, so the environment can be rebuilt exactly the same way after each test cycle.