virt-install
Create new virtual machines
TLDR
Create a virtual machine with 1 GB RAM and 12 GB storage and start a Debian installation
Create a x86-64, KVM-accelerated, UEFI-based virtual machine with the Q35 chipset, 4 GiB RAM, 16 GiB RAW storage, and start a Fedora installation
Create a diskless live virtual machine without an emulated sound device or a USB controller. Don't start an installation and don't autoconnect to console but attach a cdrom to it (might be useful for when using a live CD like tails)
Create a virtual machine with 16 GiB RAM, 250 GiB storage, 8 cores with hyperthreading, a specific CPU topology, and a CPU model that shares most features with the host CPU
Create a virtual machine and kickstart an automated deployment based on Fedora 35 using only remote resources (no ISO required)
SYNOPSIS
virt-install [OPTIONS]
PARAMETERS
--name VM_NAME
Name of the virtual machine.
--memory MEMORY
Memory to allocate to the VM, in MB.
--vcpus VCPUS
Number of virtual CPUs for the VM.
--os-type OS_TYPE
Type of operating system being installed (e.g., linux, windows).
--os-variant OS_VARIANT
More specific operating system variant (e.g., fedora38, win10).
--disk PATH,size=SIZE
Create a disk image at PATH with the specified SIZE (in GB).
--cdrom PATH
Path to an ISO image to use as a CD-ROM drive.
--location URL
URL of a network installation source (e.g., HTTP, FTP).
--network NETWORK_SOURCE
Specify the network configuration for the VM.
--graphics TYPE
Specify the graphics configuration (e.g., vnc, spice, none).
--noautoconsole
Do not automatically connect to the VM's console.
--hvm
Use full hardware virtualization.
--paravirt
Use paravirtualization.
DESCRIPTION
virt-install is a command-line tool for creating new virtual machines using the libvirt virtualization management library. It supports various virtualization technologies like KVM, Xen, and QEMU.
The command takes parameters specifying the virtual machine's name, the installation source (ISO image, network URL, etc.), the amount of memory, number of virtual CPUs, and disk configuration. It provides a flexible way to automate virtual machine creation and configure their resources according to specific needs.
virt-install can be used to create VMs interactively or as part of scripts for automated deployment and provisioning. It uses the libvirt API to manage the VM lifecycle, including creating, starting, stopping, and deleting virtual machines. This versatility makes it a powerful tool for virtualization administrators and developers.
CAVEATS
Requires root privileges or appropriate libvirt permissions to create virtual machines. Ensure the host system has sufficient resources (CPU, memory, disk space) before creating a VM. Network configuration can be complex and requires understanding of bridging and virtual networking.
INSTALLATION SOURCES
virt-install supports several installation sources.
--location downloads the installation tree from the URL.
--cdrom use a local ISO image for installation.
NETWORKING
virt-install provides flexible networking options. You can use a bridged network (--network bridge=br0), a NAT network (--network network=default) or even configure a private network.
HISTORY
virt-install was created as part of the libvirt project to simplify the process of creating virtual machines from the command line. It evolved alongside libvirt, gaining support for new virtualization technologies and operating systems. Its early versions focused on basic VM creation, while later versions introduced more advanced features such as network configuration, storage management, and graphical console integration. It is a core part of the virtualization ecosystem and is widely used for both interactive VM creation and automated deployments.
SEE ALSO
virsh(1), qemu(1), virt-manager(1)