VIRT-INSTALL(1) | Virtualization Support | VIRT-INSTALL(1) |
virt-install - provision new virtual machines
virt-install [OPTION]...
virt-install is a command line tool for creating new KVM, Xen, or Linux container guests using the libvirt hypervisor management library. See the EXAMPLES section at the end of this document to quickly get started.
virt-install tool supports graphical installations using (for example) VNC or SPICE, as well as text mode installs over serial console. The guest can be configured to use one or more virtual disks, network interfaces, audio devices, physical USB or PCI devices, among others.
The installation media can be local ISO or CDROM media, or a distro install tree hosted remotely over HTTP, FTP, or in a local directory. In the install tree case virt-install will fetch the minimal files necessary to kick off the installation process, allowing the guest to fetch the rest of the OS distribution as needed. PXE booting, and importing an existing disk image (thus skipping the install phase) are also supported.
Given suitable command line arguments, virt-install is capable of running completely unattended, with the guest 'kickstarting' itself too. This allows for easy automation of guest installs. This can be done manually, or more simply with the --unattended option.
Many arguments have sub options, specified like opt1=foo,opt2=bar, etc. Try --option=? to see a complete list of sub options associated with that argument, example: virt-install --disk=?
Most options are not required. If a suitable --os-variant value is specified or detected, all defaults will be filled in and reported in the terminal output. If an --os-variant is not specified. minimum required options, --memory, guest storage (--disk or --filesystem), and an install method choice.
Syntax: --connect URI
Connect to a non-default hypervisor. If this isn't specified, libvirt will try and choose the most suitable default.
Some valid options here are:
General configuration parameters that apply to all types of guest installs.
Syntax: -n, --name NAME
Name of the new guest virtual machine instance. This must be unique amongst all guests known to the hypervisor on the connection, including those not currently active. To re-define an existing guest, use the virsh(1) tool to shut it down ('virsh shutdown') & delete ('virsh undefine') it prior to running virt-install.
Syntax: --memory OPTIONS
Memory to allocate for the guest, in MiB. This deprecates the -r/--ram option. Sub options are available, like 'memory', 'currentMemory', 'maxMemory' and 'maxMemory.slots', which all map to the identically named XML values.
Back compat values 'memory' maps to the <currentMemory> element, and maxmemory maps to the <memory> element.
To configure memory modules which can be hotunplugged see --memdev description.
Use --memory=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsMemoryAllocation
Syntax: --memorybacking OPTIONS
This option will influence how virtual memory pages are backed by host pages.
Use --memorybacking=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsMemoryBacking
Syntax: --arch ARCH
Request a non-native CPU architecture for the guest virtual machine. If omitted, the host CPU architecture will be used in the guest.
Syntax: --machine MACHINE
The machine type to emulate. This will typically not need to be specified for Xen or KVM, but is useful for choosing machine types of more exotic architectures.
Syntax: --metadata OPT=VAL,[...]
Specify metadata values for the guest. Possible options include name, uuid, title, and description. This option deprecates -u/--uuid and --description.
Use --metadata=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsMetadata
Syntax: --events OPT=VAL,[...]
Specify events values for the guest. Possible options include on_poweroff, on_reboot, and on_crash.
Use --events=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsEvents
Syntax: --resource OPT=VAL,[...]
Specify resource partitioning for the guest.
Use --resource=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#resPartition
Syntax: --sysinfo OPT=VAL,[...]
Configure sysinfo/SMBIOS values exposed to the VM OS. Examples:
Use --sysinfo=? to see a list of all available sub options.
Complete details at https://libvirt.org/formatdomain.html#elementsSysinfo and https://libvirt.org/formatdomain.html#elementsOSBIOS for smbios XML element.
Syntax: --xml ARGS
Make direct edits to the generated XML using XPath syntax. Take an example like
virt-install --xml ./@foo=bar --xml ./newelement/subelement=1
This will alter the generated XML to contain:
<domain foo='bar' ...>
...
<newelement>
<subelement>1</subelement>
</newelement> </domain>
The --xml option has 4 sub options:
If value is empty, it's treated as unsetting that particular node.
Syntax: --qemu-commandline ARGS
Pass options directly to the qemu emulator. Only works for the libvirt qemu driver. The option can take a string of arguments, for example:
--qemu-commandline="-display gtk,gl=on"
Environment variables are specified with 'env', for example:
--qemu-commandline=env=DISPLAY=:0.1
Complete details about the libvirt feature: https://libvirt.org/drvqemu.html#qemucommand
Syntax: --vcpus OPTIONS
Number of virtual cpus to configure for the guest. If 'maxvcpus' is specified, the guest will be able to hotplug up to MAX vcpus while the guest is running, but will startup with VCPUS.
CPU topology can additionally be specified with sockets, cores, and threads. If values are omitted, the rest will be autofilled preferring sockets over cores over threads.
'cpuset' sets which physical cpus the guest can use. CPUSET is a comma separated list of numbers, which can also be specified in ranges or cpus to exclude. Example:
0,2,3,5 : Use processors 0,2,3 and 5 1-5,^3,8 : Use processors 1,2,4,5 and 8
If the value 'auto' is passed, virt-install attempts to automatically determine an optimal cpu pinning using NUMA data, if available.
Use --vcpus=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsCPUAllocation
Syntax: --numatune OPTIONS
Tune NUMA policy for the domain process. Example invocations
--numatune 1,2,3,4-7 --numatune 1-3,5,memory.mode=preferred
Specifies the numa nodes to allocate memory from. This has the same syntax as --vcpus cpuset= option. mode can be one of 'interleave', 'preferred', or 'strict' (the default). See 'man 8 numactl' for information about each mode.
Use --numatune=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsNUMATuning
Syntax: --memtune OPTIONS
Tune memory policy for the domain process. Example invocations
--memtune 1000 --memtune hard_limit=100,soft_limit=60,swap_hard_limit=150,min_guarantee=80
Use --memtune=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsMemoryTuning
Syntax: --blkiotune OPTIONS
Tune blkio policy for the domain process. Example invocations
--blkiotune 100 --blkiotune weight=100,device.path=/dev/sdc,device.weight=200
Use --blkiotune=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsBlockTuning
Syntax: --cpu MODEL[,+feature][,-feature][,match=MATCH][,vendor=VENDOR],...
Configure the CPU model and CPU features exposed to the guest. The only required value is MODEL, which is a valid CPU model as known to libvirt.
Libvirt's feature policy values force, require, optional, disable, or forbid, or with the shorthand '+feature' and '-feature', which equal 'force=feature' and 'disable=feature' respectively.
If exact CPU model is specified virt-install will automatically copy CPU features available on the host to mitigate recent CPU speculative execution side channel and Microarchitectural Store Buffer Data security vulnerabilities. This however will have some impact on performance and will break migration to hosts without security patches. In order to control this behavior there is a secure parameter. Possible values are on and off, with on as the default. It is highly recommended to leave this enabled and ensure all virtualization hosts have fully up to date microcode, kernel & virtualization software installed.
Some examples:
<cpu>
<numa>
<cell cpus="0-3" memory="1234"/>
<cell cpus="4-7" memory="5678"/>
</numa> </cpu>
Use --cpu=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsCPU
Syntax: --cputune OPTIONS
Tune CPU parameters for the guest.
Configure which of the host's physical CPUs the domain VCPU will be pinned to. Example invocation
--cputune vcpupin0.vcpu=0,vcpupin0.cpuset=0-3,vcpupin1.vcpu=1,vcpupin1.cpuset=4-7
Use --cputune=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsCPUTuning
Syntax: --security, --seclabel type=TYPE[,label=LABEL][,relabel=yes|no],...
Configure domain seclabel domain settings. Type can be either 'static' or 'dynamic'. 'static' configuration requires a security LABEL. Specifying LABEL without TYPE implies static configuration.
Use --security=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#seclabel
Syntax: --keywrap OPTIONS
Specify domain <keywrap> XML, used for S390 cryptographic key management operations.
Use --keywrap=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#keywrap
Syntax: --iothreads OPTIONS
Specify domain <iothreads> and/or <iothreadids> XML. For example, to configure <iothreads>4</iothreads>, use --iothreads 4
Use --iothreads=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsIOThreadsAllocation
Syntax: --features FEAT=on|off,...
Set elements in the guests <features> XML on or off. Examples include acpi, apic, eoi, privnet, and hyperv features. Some examples:
Use --features=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsFeatures
Syntax: --clock offset=OFFSET,TIMER_OPT=VAL,...
Configure the guest's <clock> XML. Some supported options:
Use --clock=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsTime
Syntax: --pm OPTIONS
Configure guest power management features. Example:
--pm suspend_to_memi.enabled=on,suspend_to_disk.enabled=off
Use --pm=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsPowerManagement
Syntax: --launchSecurity TYPE[,OPTS]
Enable launch security for the guest, e.g. AMD SEV. Example invocations:
# This will use a default policy 0x03 # No dhCert provided, so no data can be exchanged with the SEV firmware --launchSecurity sev # Explicit policy 0x01 - disables debugging, allows guest key sharing --launchSecurity sev,policy=0x01 # Provide the session blob obtained from the SEV firmware # Provide dhCert to open a secure communication channel with SEV firmware --launchSecurity sev,session=BASE64SESSIONSTRING,dhCert=BASE64DHCERTSTRING
SEV has further implications on usage of virtio devices, so refer to EXAMPLES section to see a full invocation of virt-install with --launchSecurity.
Use --launchSecurity=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#launchSecurity
Syntax: --cdrom PATH
ISO file or CDROM device to use for VM install media. After install, the the virtual CDROM device will remain attached to the VM, but with the ISO or host path media ejected.
Syntax: -l, --location OPTIONS
Distribution tree installation source. virt-install can recognize certain distribution trees and fetches a bootable kernel/initrd pair to launch the install.
--location allows things like --extra-args for kernel arguments, and using --initrd-inject. If you want to use those options with CDROM media, you can pass the ISO to --location as well which works for some, but not all, CDROM media.
The LOCATION can take one of the following forms:
Some distro specific url samples:
Additionally, --location can take 'kernel' and 'initrd' sub options. These paths relative to the specified location URL/ISO that allow selecting specific files for kernel/initrd within the install tree. This can be useful if virt-install/ libosinfo doesn't know where to find the kernel in the specified --location.
For example, if you have an ISO that libosinfo doesn't know about called my-unknown.iso, with a kernel at 'kernel/fookernel' and initrd at 'kernel/fooinitrd', you can make this work with:
--location my-unknown.iso,kernel=kernel/fookernel,initrd=kernel/fooinitrd
Install from PXE. This just tells the VM to boot off the network for the first boot.
Skip the OS installation process, and build a guest around an existing disk image. The device used for booting is the first device specified via --disk or --filesystem.
Syntax: -x, --extra-args KERNELARGS
Additional kernel command line arguments to pass to the installer when performing a guest install from --location. One common usage is specifying an anaconda kickstart file for automated installs, such as --extra-args "ks=https://myserver/my.ks"
Syntax: --initrd-inject PATH
Add PATH to the root of the initrd fetched with --location. This can be used to run an automated install without requiring a network hosted kickstart file: --initrd-inject=/path/to/my.ks --extra-args "ks=file:/my.ks"
This is a larger entry point for various types of install operations. The command has multiple subarguments, similar to --disk and friends. This option is strictly for VM install operations, essentially configuring the first boot.
The simplest usage to ex: install fedora29 is:
--install fedora29
And virt-install will fetch a --location URL from libosinfo, and populate defaults from there.
Available suboptions:
Example case using local filesystem paths: --install kernel=/path/to/kernel,initrd=/path/to/initrd
Example using network paths. Kernel/initrd will be downloaded locally first, then passed to the VM as local filesystem paths: --install kernel=https://127.0.0.1/tree/kernel,initrd=https://127.0.0.1/tree/initrd
Note, these are just for install time booting. If you want to set the kernel used for permanent VM booting, use the --boot option.
If you want to install off a cdrom or network, it's probably simpler and more backwards compatible to just use --cdrom or --pxe , but this options gives fine grained control over the install process if needed.
Reinstall an existing VM. DOMAIN can be a VM name, UUID, or ID number. virt-install will fetch the domain XML from libvirt, apply the specified install config changes, boot the VM for the install process, and then revert to roughly the same starting XML.
Only install related options are processed, all other VM configuration options like --name, --disk, etc. are completely ignored.
If --reinstall is used with --cdrom, an existing CDROM attached to the VM will be used if one is available, otherwise a permanent CDROM device will be added.
Syntax: --unattended [OPTIONS]
Perform an unattended install using libosinfo's install script support. This is essentially a database of auto install scripts for various distros: Red Hat kickstarts, Debian installer scripting, Windows unattended installs, and potentially others. The simplest invocation is to combine it with --install like:
--install fedora29 --unattended
A Windows install will look like
--cdrom /path/to/my/windows.iso --unattended
Sub options are:
Pass cloud-init metadata to the VM. A cloud-init NoCloud ISO file is generated, and attached to the VM as a CDROM device. The device is only attached for the first boot. This option is particularly useful for distro cloud images, which have locked login accounts by default; --cloud-init provides the means to initialize those login accounts, like setting a root password.
The simplest invocation is just plain --cloud-init with no suboptions; this maps to --cloud-init root-password-generate=on,disable=on. See those suboptions for explanation of how they work.
Use --cloud-init=? to see a list of all available sub options.
Sub options are:
Syntax: --boot BOOTOPTS
Optionally specify the post-install VM boot configuration. This option allows specifying a boot device order, permanently booting off kernel/initrd with option kernel arguments, and enabling a BIOS boot menu (requires libvirt 0.8.3 or later)
--boot can be specified in addition to other install options (such as --location, --cdrom, etc.) or can be specified on its own. In the latter case, behavior is similar to the --import install option: there is no 'install' phase, the guest is just created and launched as specified.
Some examples:
Use --boot=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsOS
Syntax: --idmap OPTIONS
If the guest configuration declares a UID or GID mapping, the 'user' namespace will be enabled to apply these. A suitably configured UID/GID mapping is a pre-requisite to make containers secure, in the absence of sVirt confinement.
--idmap can be specified to enable user namespace for LXC containers. Example:
--idmap uid.start=0,uid.target=1000,uid.count=10,gid.start=0,gid.target=1000,gid.count=10
Use --idmap=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsOSContainer
Syntax: --os-variant [OS_VARIANT|OPT1=VAL1,...]
Optimize the guest configuration for a specific operating system (ex. 'fedora29', 'rhel7', 'win10'). While not required, specifying this options is HIGHLY RECOMMENDED, as it can greatly increase performance by specifying virtio among other guest tweaks.
The simplest usage is --os-variant OS-NAME, for example --os-variant fedora32. --os-variant supports explicit suboption syntax as well:
Some interesting examples:
By default, virt-install will do --os-variant detect=on,name=generic, using the detected OS if found, and falling back to the stub generic value otherwise, and printing a warning.
If any manual --os-variant value is specified, the default is all settings off or unset.
Use the command "osinfo-query os" to get the list of the accepted OS variant names.
Syntax: --disk OPTIONS
Specifies media to use as storage for the guest, with various options. The general format of a disk string is
--disk opt1=val1,opt2=val2,...
The simplest invocation to create a new 10G disk image and associated disk device:
--disk size=10
virt-install will generate a path name, and place it in the default image location for the hypervisor. To specify media, the command can either be:
--disk /some/storage/path[,opt1=val1]...
or explicitly specify one of the following arguments:
Specifying a non-existent path implies attempting to create the new storage, and will require specifying a 'size' value. Even for remote hosts, virt-install will try to use libvirt storage APIs to automatically create the given path.
If the hypervisor supports it, path can also be a network URL, like https://example.com/some-disk.img . For network paths, they hypervisor will directly access the storage, nothing is downloaded locally.
Options that apply to storage creation:
The initial time taken to fully-allocate the guest virtual disk (sparse=no) will be usually balanced by faster install times inside the guest. Thus use of this option is recommended to ensure consistently high performance and to avoid I/O errors in the guest should the host filesystem fill up.
If not specified when creating file images, this will default to 'qcow2'.
If creating storage, this will be the format of the new image. If using an existing image, this overrides libvirt's format auto-detection.
Some example device configuration suboptions:
See the examples section for some uses. This option deprecates -f/--file, -s/--file-size, --nonsparse, and --nodisks.
Use --disk=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsDisks
Specifies a directory on the host to export to the guest. The most simple invocation is:
--filesystem /source/on/host,/target/point/in/guest
Which will work for recent QEMU and linux guest OS or LXC containers. For QEMU, the target point is just a mounting hint in sysfs, so will not be automatically mounted.
Some example suboptions:
Use --filesystem=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsFilesystems
Syntax: -w, --network OPTIONS
Connect the guest to the host network. Examples for specifying the network type:
If --network is omitted a single NIC will be created in the guest. If there is a bridge device in the host with a physical interface attached, that will be used for connectivity. Failing that, the virtual network called default will be used. This option can be specified multiple times to setup more than one NIC.
Some example suboptions:
Use --network=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsNICS
This option deprecates -m/--mac, -b/--bridge, and --nonetworks
If no graphics option is specified, virt-install will try to select the appropriate graphics if the DISPLAY environment variable is set, otherwise '--graphics none' is used.
Syntax: --graphics TYPE,opt1=arg1,opt2=arg2,...
Specifies the graphical display configuration. This does not configure any virtual hardware, just how the guest's graphical display can be accessed. Typically the user does not need to specify this option, virt-install will try and choose a useful default, and launch a suitable connection.
General format of a graphical string is
--graphics TYPE,opt1=arg1,opt2=arg2,...
For example:
--graphics vnc,password=foobar
Some supported TYPE values:
Using spice graphic type will work as if those arguments were given:
--video qxl --channel spicevmc
Some supported suboptions:
If -1 is specified, the WebSocket port is auto-allocated.
This is used by 'vnc' and 'spice'
Use 'none' to specify that the display server should not listen on any port. The display server can be accessed only locally through libvirt unix socket (virt-viewer with --attach for instance).
Use 'socket' to have the VM listen on a libvirt generated unix socket path on the host filesystem.
This is used by 'vnc' and 'spice'
Use --graphics=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsGraphics
This deprecates the following options: --vnc, --vncport, --vnclisten, -k/--keymap, --sdl, --nographics
Syntax: --autoconsole OPTIONS
Configure what interactive console virt-install will launch for the VM. This option is not required; the default behavior is adaptive and dependent on how the VM is configured. But you can use this option to override the default choice.
Note, virt-install exits quickly when this option is specified. If your command requested a multistep install, like --cdrom or --location, after the install phase is complete the VM will be shutoff, regardless of whether a reboot was requested in the VM. If you want the VM to be rebooted, virt-install must remain running. You can use '--wait' to keep virt-install alive even if --noautoconsole is specified.
Options to override the default virtualization type choices.
Request the use of full virtualization, if both para & full virtualization are available on the host. This parameter may not be available if connecting to a Xen hypervisor on a machine without hardware virtualization support. This parameter is implied if connecting to a QEMU based hypervisor.
This guest should be a paravirtualized guest. If the host supports both para & full virtualization, and neither this parameter nor the --hvm are specified, this will be assumed.
This guest should be a container type guest. This option is only required if the hypervisor supports other guest types as well (so for example this option is the default behavior for LXC and OpenVZ, but is provided for completeness).
The hypervisor to install on. Example choices are kvm, qemu, or xen. Available options are listed via 'virsh capabilities' in the <domain> tags.
This deprecates the --accelerate option, which is now the default behavior. To install a plain QEMU guest, use '--virt-type qemu'
All devices have a set of address.* options for configuring the particulars of the device's address on its parent controller or bus. See https://libvirt.org/formatdomain.html#elementsAddress for details.
Syntax: --controller OPTIONS
Attach a controller device to the guest. TYPE is one of: ide, fdc, scsi, sata, virtio-serial, or usb .
Controller also supports the special values usb2 and usb3 to specify which version of the USB controller should be used (version 2 or 3).
Some example suboptions:
Use --controller=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsControllers
Syntax: --input OPTIONS
Attach an input device to the guest. Example input device types are mouse, tablet, or keyboard.
Use --input=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsInput
Syntax: --hostdev, --host-device OPTIONS
Attach a physical host device to the guest. Some example values for HOSTDEV:
Use --hostdev=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsHostDev
Syntax: --sound MODEL
Attach a virtual audio device to the guest. MODEL specifies the emulated sound card model. Possible values are ich6, ich9, ac97, es1370, sb16, pcspk, or default. 'default' will try to pick the best model that the specified OS supports.
This deprecates the old --soundhw option. Use --sound=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsSound
Syntax: --watchdog MODEL[,action=ACTION]
Attach a virtual hardware watchdog device to the guest. This requires a daemon and device driver in the guest. The watchdog fires a signal when the virtual machine appears to hung. ACTION specifies what libvirt will do when the watchdog fires. Values are
MODEL is the emulated device model: either i6300esb (the default) or ib700. Some examples:
Use --watchdog=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsWatchdog
Syntax: --serial OPTIONS
Specifies a serial device to attach to the guest, with various options. The general format of a serial string is
--serial type,opt1=val1,opt2=val2,...
--serial and --parallel devices share all the same options, unless otherwise noted. Some of the types of character device redirection are:
Wait for connections on any address, port 4567:
--serial tcp,host=0.0.0.0:4567
Connect to localhost, port 1234:
--serial tcp,host=:1234,source.mode=connect
Wait for telnet connection on localhost, port 2222. The user could then connect interactively to this console via 'telnet localhost 2222':
--serial tcp,host=:2222,source.mode=bind,source.protocol=telnet
Send output to default syslog port (may need to edit /etc/rsyslog.conf accordingly):
--serial udp,host=:514
Send output to remote host 192.168.10.20, port 4444 (this output can be read on the remote host using 'nc -u -l 4444'):
--serial udp,host=192.168.10.20:4444
Use --serial=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsCharSerial
Syntax: --parallel OPTIONS
Specify a parallel device. The format and options are largely identical to serial
Use --parallel=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsCharParallel
Specifies a communication channel device to connect the guest and host machine. This option uses the same options as --serial and --parallel for specifying the host/source end of the channel. Extra 'target' options are used to specify how the guest machine sees the channel.
Some of the types of character device redirection are:
Use --channel=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsCharChannel
Connect a text console between the guest and host. Certain guest and hypervisor combinations can automatically set up a getty in the guest, so an out of the box text login can be provided (target_type=xen for xen paravirt guests, and possibly target_type=virtio in the future).
Example:
Use --console=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsCharConsole
Syntax: --video OPTIONS
Specify what video device model will be attached to the guest. Valid values for VIDEO are hypervisor specific, but some options for recent kvm are cirrus, vga, qxl, virtio, or vmvga (vmware). Use --video=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsVideo
Syntax: --smartcard MODE[,OPTIONS]
Configure a virtual smartcard device.
Example MODE values are host, host-certificates, or passthrough. Example suboptions include:
An example invocation:
Use --smartcard=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsSmartcard
Syntax: --redirdev BUS[,OPTIONS]
Add a redirected device. Example suboptions:
Examples invocations:
Use --redirdev=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsRedir
Syntax: --memballoon MODEL[,OPTIONS]
Attach a virtual memory balloon device to the guest. If the memballoon device needs to be explicitly disabled, MODEL='none' is used.
MODEL is the type of memballoon device provided. The value can be 'virtio', 'xen' or 'none'. Some examples:
Use --memballoon=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsMemBalloon
Syntax: --tpm TYPE[,OPTIONS]
Configure a virtual TPM device. Examples:
Use --tpm=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsTpm
Syntax: --rng TYPE[,OPTIONS]
Configure a virtual RNG device.
Example TYPE values include random, egd or builtin.
Example invocations:
Use --rng=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsRng
Syntax: --panic MODEL[,OPTS]
Attach a panic notifier device to the guest. For the recommended settings, use: --panic default
Use --panic=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsPanic
Syntax: --memdev OPTS
Add a memory module to a guest which can be hotunplugged. To add a memdev you need to configure hotplugmemory and NUMA for a guest.
Use --memdev=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#elementsMemory.
Syntax: --vsock OPTS
Configure a vsock host/guest interface. A typical configuration would be
--vsock cid.auto=yes
Use --vsock=? to see a list of all available sub options. Complete details at https://libvirt.org/formatdomain.html#vsock.
Syntax: --iommu MODEL[,OPTS]
Add an IOMMU device to the guest.
Use --iommu=? to see a list of all available options. Complete details at https://libvirt.org/formatdomain.html#elementsIommu.
Show the help message and exit
Show program's version number and exit
Set the autostart flag for a domain. This causes the domain to be started on host boot up.
Use --import or --boot and --transient if you want a transient libvirt VM. These VMs exist only until the domain is shut down or the host server is restarted. Libvirt forgets the XML configuration of the VM after either of these events. Note that the VM's disks will not be deleted. See: https://wiki.libvirt.org/page/VM_lifecycle#Transient_guest_domains_vs_Persistent_guest_domains
When the VM console window is exited, destroy (force poweroff) the VM. If you combine this with --transient, this makes the virt-install command work similar to qemu, where the VM is shutdown when the console window is closed by the user.
Syntax: --print-xml [STEP]
Print the generated XML of the guest, instead of defining it. By default this WILL do storage creation (can be disabled with --dry-run). This option implies --quiet.
If the VM install has multiple phases, by default this will print all generated XML. If you want to print a particular step, use --print-xml 2 (for the second phase XML).
Prevent the domain from automatically rebooting after the install has completed.
Syntax: --wait WAIT
Configure how virt-install will wait for the install to complete. Without this option, virt-install will wait for the console to close (not necessarily indicating the guest has shutdown), or in the case of --noautoconsole, simply kick off the install and exit.
Bare '--wait' or any negative value will make virt-install wait indefinitely. Any positive number is the number of minutes virt-install will wait. If the time limit is exceeded, virt-install simply exits, leaving the virtual machine in its current state.
Proceed through the guest creation process, but do NOT create storage devices, change host device configuration, or actually teach libvirt about the guest. virt-install may still fetch install media, since this is required to properly detect the OS to install.
Enable or disable some validation checks. Some examples are warning about using a disk that's already assigned to another VM (--check path_in_use=on|off), or warning about potentially running out of space during disk allocation (--check disk_size=on|off). Most checks are performed by default.
Only print fatal error messages.
Print debugging information to the terminal when running the install process. The debugging information is also stored in ~/.cache/virt-manager/virt-install.log even if this parameter is omitted.
The simplest invocation to interactively install a Fedora 29 KVM VM with recommended defaults. virt-viewer(1) will be launched to graphically interact with the VM install
# sudo virt-install --install fedora29
Similar, but use libosinfo's unattended install support, which will perform the fedora29 install automatically without user intervention:
# sudo virt-install --install fedora29 --unattended
Install a Windows 10 VM, using 40GiB storage in the default location and 4096MiB of ram, and ensure we are connecting to the system libvirtd instance:
# virt-install \
--connect qemu:///system \
--name my-win10-vm \
--memory 4096 \
--disk size=40 \
--os-variant win10 \
--cdrom /path/to/my/win10.iso
Install a CentOS 7 KVM from a URL, with recommended device defaults and default required storage, but specifically request VNC graphics instead of the default SPICE, and request 8 virtual CPUs and 8192 MiB of memory:
# virt-install \
--connect qemu:///system \
--memory 8192 \
--vcpus 8 \
--graphics vnc \
--os-variant centos7.0 \
--location http://mirror.centos.org/centos-7/7/os/x86_64/
Create a VM around an existing debian9 disk image:
# virt-install \
--import \
--memory 512 \
--disk /home/user/VMs/my-debian9.img \
--os-variant debian9
Start serial QEMU ARM VM, which requires specifying a manual kernel.
# virt-install \
--name armtest \
--memory 1024 \
--arch armv7l --machine vexpress-a9 \
--disk /home/user/VMs/myarmdisk.img \
--boot kernel=/tmp/my-arm-kernel,initrd=/tmp/my-arm-initrd,dtb=/tmp/my-arm-dtb,kernel_args="console=ttyAMA0 rw root=/dev/mmcblk0p3" \
--graphics none
Start an SEV launch security VM with 4GB RAM, 4GB+256MiB of hard_limit, with a couple of virtio devices:
Note: The IOMMU flag needs to be turned on with driver.iommu for virtio devices. Usage of --memtune is currently required because of SEV limitations, refer to libvirt docs for a detailed explanation.
# virt-install \
--name foo \
--memory 4096 \
--boot uefi \
--machine q35 \
--memtune hard_limit=4563402 \
--disk size=15,target.bus=scsi \
--import \
--controller type=scsi,model=virtio-scsi,driver.iommu=on \
--controller type=virtio-serial,driver.iommu=on \
--network network=default,model=virtio,driver.iommu=on \
--rng /dev/random,driver.iommu=on \
--memballoon driver.iommu=on \
--launchSecurity sev
Please see https://virt-manager.org/bugs
Copyright (C) Red Hat, Inc, and various contributors. This is free software. You may redistribute copies of it under the terms of the GNU General Public License https://www.gnu.org/licenses/gpl.html. There is NO WARRANTY, to the extent permitted by law.
virsh(1), virt-clone(1), virt-manager(1), the project website https://virt-manager.org