1============ 2virt-install 3============ 4 5------------------------------ 6provision new virtual machines 7------------------------------ 8 9:Manual section: 1 10:Manual group: Virtualization Support 11 12 13 14SYNOPSIS 15======== 16 17``virt-install`` [OPTION]... 18 19 20 21DESCRIPTION 22=========== 23 24``virt-install`` is a command line tool for creating new KVM, Xen, or Linux 25container guests using the ``libvirt`` hypervisor management library. 26See the EXAMPLES section at the end of this document to quickly get started. 27 28``virt-install`` tool supports graphical installations using (for example) 29VNC or SPICE, as well as text mode installs over serial console. The guest 30can be configured to use one or more virtual disks, network interfaces, 31audio devices, physical USB or PCI devices, among others. 32 33The installation media can be local ISO or CDROM media, or a distro install 34tree hosted remotely over HTTP, FTP, or in a local directory. In the install 35tree case ``virt-install`` will fetch the minimal files 36necessary to kick off the installation process, allowing the guest 37to fetch the rest of the OS distribution as needed. PXE booting, and importing 38an existing disk image (thus skipping the install phase) are also supported. 39 40Given suitable command line arguments, ``virt-install`` is capable of running 41completely unattended, with the guest 'kickstarting' itself too. This allows 42for easy automation of guest installs. This can be done manually, or more 43simply with the --unattended option. 44 45Many arguments have sub options, specified like opt1=foo,opt2=bar, etc. Try 46--option=? to see a complete list of sub options associated with that 47argument, example: virt-install --disk=? 48 49Most options are not required. If a suitable --os-variant value is specified 50or detected, all defaults will be filled in and reported in the terminal 51output. If an --os-variant is not specified. minimum required options, --memory, 52guest storage (--disk or --filesystem), and an install method choice. 53 54 55 56CONNECTING TO LIBVIRT 57===================== 58 59 60``--connect`` 61^^^^^^^^^^^^^ 62 63**Syntax:** ``--connect`` URI 64 65Connect to a non-default hypervisor. If this isn't specified, libvirt 66will try and choose the most suitable default. 67 68Some valid options here are: 69 70qemu:///system 71 For creating KVM and QEMU guests to be run by the system libvirtd instance. 72 This is the default mode that virt-manager uses, and what most KVM users 73 want. 74 75qemu:///session 76 For creating KVM and QEMU guests for libvirtd running as the regular user. 77 78xen:/// 79 For connecting to Xen. 80 81lxc:/// 82 For creating linux containers 83 84 85GENERAL OPTIONS 86=============== 87 88General configuration parameters that apply to all types of guest installs. 89 90 91 92``-n``, ``--name`` 93^^^^^^^^^^^^^^^^^^ 94 95**Syntax:** ``-n``, ``--name`` NAME 96 97Name of the new guest virtual machine instance. This must be unique amongst 98all guests known to the hypervisor on the connection, including those not 99currently active. To re-define an existing guest, use the ``virsh(1)`` tool 100to shut it down ('virsh shutdown') & delete ('virsh undefine') it prior to 101running ``virt-install``. 102 103 104 105``--memory`` 106^^^^^^^^^^^^ 107 108**Syntax:** ``--memory`` OPTIONS 109 110Memory to allocate for the guest, in MiB. This deprecates the -r/--ram option. 111Sub options are available, like 'memory', 'currentMemory', 'maxMemory' 112and 'maxMemory.slots', which all map to the identically named XML values. 113 114Back compat values 'memory' maps to the <currentMemory> element, and maxmemory 115maps to the <memory> element. 116 117To configure memory modules which can be hotunplugged see ``--memdev`` description. 118 119Use --memory=? to see a list of all available sub options. 120Complete details at https://libvirt.org/formatdomain.html#elementsMemoryAllocation 121 122 123 124``--memorybacking`` 125^^^^^^^^^^^^^^^^^^^ 126 127**Syntax:** ``--memorybacking`` OPTIONS 128 129This option will influence how virtual memory pages are backed by host pages. 130 131Use --memorybacking=? to see a list of all available sub options. 132Complete details at https://libvirt.org/formatdomain.html#elementsMemoryBacking 133 134 135 136``--arch`` 137^^^^^^^^^^ 138 139**Syntax:** ``--arch`` ARCH 140 141Request a non-native CPU architecture for the guest virtual machine. 142If omitted, the host CPU architecture will be used in the guest. 143 144 145 146``--machine`` 147^^^^^^^^^^^^^ 148 149**Syntax:** ``--machine`` MACHINE 150 151The machine type to emulate. This will typically not need to be specified 152for Xen or KVM, but is useful for choosing machine types of more exotic 153architectures. 154 155 156 157``--metadata`` 158^^^^^^^^^^^^^^ 159 160**Syntax:** ``--metadata`` OPT=VAL,[...] 161 162Specify metadata values for the guest. Possible options include name, uuid, 163title, and description. This option deprecates -u/--uuid and --description. 164 165Use --metadata=? to see a list of all available sub options. 166Complete details at https://libvirt.org/formatdomain.html#elementsMetadata 167 168 169 170``--events`` 171^^^^^^^^^^^^ 172 173**Syntax:** ``--events`` OPT=VAL,[...] 174 175Specify events values for the guest. Possible options include 176on_poweroff, on_reboot, and on_crash. 177 178Use --events=? to see a list of all available sub options. 179Complete details at https://libvirt.org/formatdomain.html#elementsEvents 180 181 182 183``--resource`` 184^^^^^^^^^^^^^^ 185 186**Syntax:** ``--resource`` OPT=VAL,[...] 187 188Specify resource partitioning for the guest. 189 190Use --resource=? to see a list of all available sub options. 191Complete details at https://libvirt.org/formatdomain.html#resPartition 192 193 194 195``--sysinfo`` 196^^^^^^^^^^^^^ 197 198**Syntax:** ``--sysinfo`` OPT=VAL,[...] 199 200Configure sysinfo/SMBIOS values exposed to the VM OS. Examples: 201 202``--sysinfo host`` 203 Special type that exposes the host's SMBIOS info into the VM. 204 205``--sysinfo emulate`` 206 Special type where hypervisor will generate SMBIOS info into the VM. 207 208``--sysinfo bios.vendor=custom`` or ``--sysinfo smbios,bios.vendor=custom`` 209 The default type is ``smbios`` and allows users to specify SMBIOS info manually. 210 211Use --sysinfo=? to see a list of all available sub options. 212 213Complete details at https://libvirt.org/formatdomain.html#elementsSysinfo 214and https://libvirt.org/formatdomain.html#elementsOSBIOS for ``smbios`` XML element. 215 216 217 218``--xml`` 219^^^^^^^^^ 220 221**Syntax:** ``--xml`` ARGS 222 223Make direct edits to the generated XML using XPath syntax. Take an example like 224 225.. code-block:: 226 227 virt-install --xml ./@foo=bar --xml ./newelement/subelement=1 228 229This will alter the generated XML to contain: 230 231.. code-block:: 232 233 <domain foo='bar' ...> 234 ... 235 <newelement> 236 <subelement>1</subelement> 237 </newelement> 238 </domain> 239 240The --xml option has 4 sub options: 241 242--xml xpath.set=XPATH[=VALUE] 243 The default behavior if no explicit suboption is set. Takes the form XPATH=VALUE 244 unless paired with ``xpath.value`` . See below for how value is interpreted. 245 246--xml xpath.value=VALUE 247 ``xpath.set`` will be interpreted only as the XPath string, and ``xpath.value`` will 248 be used as the value to set. May help sidestep problems if the string you need to 249 set contains a '=' equals sign. 250 251 If value is empty, it's treated as unsetting that particular node. 252 253--xml xpath.create=XPATH 254 Create the node as an empty element. Needed for boolean elements like <readonly/> 255 256--xml xpath.delete=XPATH 257 Delete the entire node specified by the xpath, and all its children 258 259 260 261``--qemu-commandline`` 262^^^^^^^^^^^^^^^^^^^^^^ 263 264**Syntax:** ``--qemu-commandline`` ARGS 265 266Pass options directly to the qemu emulator. Only works for the libvirt 267qemu driver. The option can take a string of arguments, for example: 268 269.. code-block:: 270 271 --qemu-commandline="-display gtk,gl=on" 272 273Environment variables are specified with 'env', for example: 274 275.. code-block:: 276 277 --qemu-commandline=env=DISPLAY=:0.1 278 279Complete details about the libvirt feature: https://libvirt.org/drvqemu.html#qemucommand 280 281 282 283``--vcpus`` 284^^^^^^^^^^^ 285 286**Syntax:** ``--vcpus`` OPTIONS 287 288Number of virtual cpus to configure for the guest. If 'maxvcpus' is specified, 289the guest will be able to hotplug up to MAX vcpus while the guest is running, 290but will startup with VCPUS. 291 292CPU topology can additionally be specified with sockets, cores, and threads. 293If values are omitted, the rest will be autofilled preferring sockets over 294cores over threads. 295 296'cpuset' sets which physical cpus the guest can use. ``CPUSET`` is a comma 297separated list of numbers, which can also be specified in ranges or cpus 298to exclude. Example: 299 300.. code-block:: 301 302 0,2,3,5 : Use processors 0,2,3 and 5 303 1-5,^3,8 : Use processors 1,2,4,5 and 8 304 305If the value 'auto' is passed, virt-install attempts to automatically determine 306an optimal cpu pinning using NUMA data, if available. 307 308Use --vcpus=? to see a list of all available sub options. 309Complete details at https://libvirt.org/formatdomain.html#elementsCPUAllocation 310 311 312 313``--numatune`` 314^^^^^^^^^^^^^^ 315 316**Syntax:** ``--numatune`` OPTIONS 317 318Tune NUMA policy for the domain process. Example invocations 319 320.. code-block:: 321 322 --numatune 1,2,3,4-7 323 --numatune 1-3,5,memory.mode=preferred 324 325 326Specifies the numa nodes to allocate memory from. This has the same syntax 327as ``--vcpus cpuset=`` option. mode can be one of 'interleave', 'preferred', or 328'strict' (the default). See 'man 8 numactl' for information about each 329mode. 330 331Use --numatune=? to see a list of all available sub options. 332Complete details at https://libvirt.org/formatdomain.html#elementsNUMATuning 333 334 335 336``--memtune`` 337^^^^^^^^^^^^^ 338 339**Syntax:** ``--memtune`` OPTIONS 340 341Tune memory policy for the domain process. Example invocations 342 343.. code-block:: 344 345 --memtune 1000 346 --memtune hard_limit=100,soft_limit=60,swap_hard_limit=150,min_guarantee=80 347 348Use --memtune=? to see a list of all available sub options. 349Complete details at https://libvirt.org/formatdomain.html#elementsMemoryTuning 350 351 352 353``--blkiotune`` 354^^^^^^^^^^^^^^^ 355 356**Syntax:** ``--blkiotune`` OPTIONS 357 358Tune blkio policy for the domain process. Example invocations 359 360.. code-block:: 361 362 --blkiotune 100 363 --blkiotune weight=100,device.path=/dev/sdc,device.weight=200 364 365Use --blkiotune=? to see a list of all available sub options. 366Complete details at https://libvirt.org/formatdomain.html#elementsBlockTuning 367 368 369 370``--cpu`` 371^^^^^^^^^ 372 373**Syntax:** ``--cpu`` MODEL[,+feature][,-feature][,match=MATCH][,vendor=VENDOR],... 374 375Configure the CPU model and CPU features exposed to the guest. The only 376required value is MODEL, which is a valid CPU model as known to libvirt. 377 378Libvirt's feature policy values force, require, optional, disable, or forbid, 379or with the shorthand '+feature' and '-feature', which equal 'force=feature' 380and 'disable=feature' respectively. 381 382If exact CPU model is specified virt-install will automatically copy CPU 383features available on the host to mitigate recent CPU speculative execution 384side channel and Microarchitectural Store Buffer Data security vulnerabilities. 385This however will have some impact on performance and will break migration 386to hosts without security patches. In order to control this behavior there 387is a ``secure`` parameter. Possible values are ``on`` and ``off``, with ``on`` 388as the default. It is highly recommended to leave this enabled and ensure all 389virtualization hosts have fully up to date microcode, kernel & virtualization 390software installed. 391 392Some examples: 393 394``--cpu core2duo,+x2apic,disable=vmx`` 395 Expose the core2duo CPU model, force enable x2apic, but do not expose vmx 396 397``--cpu host`` 398 Expose the host CPUs configuration to the guest. This enables the guest to 399 take advantage of many of the host CPUs features (better performance), but 400 may cause issues if migrating the guest to a host without an identical CPU. 401 402``--cpu numa.cell0.memory=1234,numa.cell0.cpus=0-3,numa.cell1.memory=5678,numa.cell1.cpus=4-7`` 403 Example of specifying two NUMA cells. This will generate XML like: 404 405 .. code-block:: 406 407 <cpu> 408 <numa> 409 <cell cpus="0-3" memory="1234"/> 410 <cell cpus="4-7" memory="5678"/> 411 </numa> 412 </cpu> 413 414 415``--cpu host-passthrough,cache.mode=passthrough`` 416 Example of passing through the host cpu's cache information. 417 418Use --cpu=? to see a list of all available sub options. 419Complete details at https://libvirt.org/formatdomain.html#elementsCPU 420 421 422 423``--cputune`` 424^^^^^^^^^^^^^ 425 426**Syntax:** ``--cputune`` OPTIONS 427 428Tune CPU parameters for the guest. 429 430Configure which of the host's physical CPUs the domain VCPU will be pinned to. 431Example invocation 432 433.. code-block:: 434 435 --cputune vcpupin0.vcpu=0,vcpupin0.cpuset=0-3,vcpupin1.vcpu=1,vcpupin1.cpuset=4-7 436 437Use --cputune=? to see a list of all available sub options. 438Complete details at https://libvirt.org/formatdomain.html#elementsCPUTuning 439 440 441 442``--security``, ``--seclabel`` 443^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 444 445**Syntax:** ``--security``, ``--seclabel`` type=TYPE[,label=LABEL][,relabel=yes|no],... 446 447Configure domain seclabel domain settings. Type can be either 'static' or 448'dynamic'. 'static' configuration requires a security LABEL. Specifying 449LABEL without TYPE implies static configuration. 450 451Use --security=? to see a list of all available sub options. 452Complete details at https://libvirt.org/formatdomain.html#seclabel 453 454 455 456``--keywrap`` 457^^^^^^^^^^^^^ 458 459**Syntax:** ``--keywrap`` OPTIONS 460 461Specify domain <keywrap> XML, used for S390 cryptographic key management operations. 462 463Use --keywrap=? to see a list of all available sub options. 464Complete details at https://libvirt.org/formatdomain.html#keywrap 465 466 467 468``--iothreads`` 469^^^^^^^^^^^^^^^ 470 471**Syntax:** ``--iothreads`` OPTIONS 472 473Specify domain <iothreads> and/or <iothreadids> XML. 474For example, to configure ``<iothreads>4</iothreads>``, use ``--iothreads 4`` 475 476Use --iothreads=? to see a list of all available sub options. 477Complete details at https://libvirt.org/formatdomain.html#elementsIOThreadsAllocation 478 479 480 481``--features`` 482^^^^^^^^^^^^^^ 483 484**Syntax:** ``--features`` FEAT=on|off,... 485 486Set elements in the guests <features> XML on or off. Examples include acpi, 487apic, eoi, privnet, and hyperv features. Some examples: 488 489``--features apic.eoi=on`` 490 Enable APIC PV EOI 491 492``--features hyperv.vapic.state=on,hyperv.spinlocks.state=off`` 493 Enable hypver VAPIC, but disable spinlocks 494 495``--features kvm.hidden.state=on`` 496 Allow the KVM hypervisor signature to be hidden from the guest 497 498``--features pvspinlock=on`` 499 Notify the guest that the host supports paravirtual spinlocks for 500 example by exposing the pvticketlocks mechanism. 501 502``--features gic.version=2`` 503 This is relevant only for ARM architectures. Possible values are "host" or 504 version number. 505 506``--features smm.state=on`` 507 This enables System Management Mode of hypervisor. Some UEFI firmwares may 508 require this feature to be present. (QEMU supports SMM only with q35 machine 509 type.) 510 511Use --features=? to see a list of all available sub options. 512Complete details at https://libvirt.org/formatdomain.html#elementsFeatures 513 514 515 516``--clock`` 517^^^^^^^^^^^ 518 519**Syntax:** ``--clock`` offset=OFFSET,TIMER_OPT=VAL,... 520 521Configure the guest's <clock> XML. Some supported options: 522 523``--clock offset=OFFSET`` 524 Set the clock offset, ex. 'utc' or 'localtime' 525 526``--clock TIMER_present=no`` 527 Disable a boolean timer. TIMER here might be hpet, kvmclock, etc. 528 529``--clock TIMER_tickpolicy=VAL`` 530 Set a timer's tickpolicy value. TIMER here might be rtc, pit, etc. VAL 531 might be catchup, delay, etc. Refer to the libvirt docs for all values. 532 533Use --clock=? to see a list of all available sub options. 534Complete details at https://libvirt.org/formatdomain.html#elementsTime 535 536 537 538``--pm`` 539^^^^^^^^ 540 541**Syntax:** ``--pm`` OPTIONS 542 543Configure guest power management features. Example: 544 545.. code-block:: 546 547 --pm suspend_to_memi.enabled=on,suspend_to_disk.enabled=off 548 549Use --pm=? to see a list of all available sub options. 550Complete details at https://libvirt.org/formatdomain.html#elementsPowerManagement 551 552 553 554``--launchSecurity`` 555^^^^^^^^^^^^^^^^^^^^ 556 557**Syntax:** ``--launchSecurity`` TYPE[,OPTS] 558 559Enable launch security for the guest, e.g. AMD SEV. Example invocations: 560 561.. code-block:: 562 563 # This will use a default policy 0x03 564 # No dhCert provided, so no data can be exchanged with the SEV firmware 565 --launchSecurity sev 566 567 # Explicit policy 0x01 - disables debugging, allows guest key sharing 568 --launchSecurity sev,policy=0x01 569 570 # Provide the session blob obtained from the SEV firmware 571 # Provide dhCert to open a secure communication channel with SEV firmware 572 --launchSecurity sev,session=BASE64SESSIONSTRING,dhCert=BASE64DHCERTSTRING 573 574 575SEV has further implications on usage of virtio devices, so refer to EXAMPLES 576section to see a full invocation of virt-install with --launchSecurity. 577 578Use --launchSecurity=? to see a list of all available sub options. Complete 579details at https://libvirt.org/formatdomain.html#launchSecurity 580 581 582 583INSTALLATION OPTIONS 584==================== 585 586``-c``, ``--cdrom`` 587^^^^^^^^^^^^^^^^^^^ 588 589**Syntax:** ``--cdrom`` PATH 590 591ISO file or CDROM device to use for VM install media. After install, 592the the virtual CDROM device will remain attached to the VM, but with 593the ISO or host path media ejected. 594 595 596 597``-l``, ``--location`` 598^^^^^^^^^^^^^^^^^^^^^^ 599 600**Syntax:** ``-l``, ``--location`` OPTIONS 601 602Distribution tree installation source. virt-install can recognize 603certain distribution trees and fetches a bootable kernel/initrd pair to 604launch the install. 605 606--location allows things like --extra-args for kernel arguments, 607and using --initrd-inject. If you want to use those options with CDROM media, 608you can pass the ISO to --location as well which works for some, but not 609all, CDROM media. 610 611The ``LOCATION`` can take one of the following forms: 612 613https://host/path 614 An HTTP server location containing an installable distribution image. 615 616ftp://host/path 617 An FTP server location containing an installable distribution image. 618 619ISO 620 Probe the ISO and extract files using 'isoinfo' 621 622DIRECTORY 623 Path to a local directory containing an installable distribution image. 624 Note that the directory will not be accessible by the guest after initial 625 boot, so the OS installer will need another way to access the rest of the 626 install media. 627 628Some distro specific url samples: 629 630Fedora/Red Hat Based 631 https://download.fedoraproject.org/pub/fedora/linux/releases/29/Server/x86_64/os 632 633Debian 634 https://ftp.us.debian.org/debian/dists/stable/main/installer-amd64/ 635 636Ubuntu 637 https://us.archive.ubuntu.com/ubuntu/dists/wily/main/installer-amd64/ 638 639Suse 640 https://download.opensuse.org/pub/opensuse/distribution/leap/42.3/repo/oss/ 641 642Additionally, --location can take 'kernel' and 'initrd' sub options. These paths 643relative to the specified location URL/ISO that allow selecting specific files 644for kernel/initrd within the install tree. This can be useful if virt-install/ 645libosinfo doesn't know where to find the kernel in the specified --location. 646 647For example, if you have an ISO that libosinfo doesn't know about called 648my-unknown.iso, with a kernel at 'kernel/fookernel' and initrd at 649'kernel/fooinitrd', you can make this work with: 650 651.. code-block:: 652 653 --location my-unknown.iso,kernel=kernel/fookernel,initrd=kernel/fooinitrd 654 655 656 657``--pxe`` 658^^^^^^^^^ 659 660Install from PXE. This just tells the VM to boot off the network 661for the first boot. 662 663 664 665``--import`` 666^^^^^^^^^^^^ 667 668Skip the OS installation process, and build a guest around an existing 669disk image. The device used for booting is the first device specified via 670``--disk`` or ``--filesystem``. 671 672 673 674``-x``, ``--extra-args`` 675^^^^^^^^^^^^^^^^^^^^^^^^ 676 677**Syntax:** ``-x``, ``--extra-args`` KERNELARGS 678 679Additional kernel command line arguments to pass to the installer when 680performing a guest install from ``--location``. One common usage is specifying 681an anaconda kickstart file for automated installs, such as 682--extra-args "ks=https://myserver/my.ks" 683 684 685 686``--initrd-inject`` 687^^^^^^^^^^^^^^^^^^^ 688 689**Syntax:** ``--initrd-inject`` PATH 690 691Add PATH to the root of the initrd fetched with ``--location``. This can be 692used to run an automated install without requiring a network hosted kickstart 693file: ``--initrd-inject=/path/to/my.ks --extra-args "ks=file:/my.ks"`` 694 695 696 697``--install`` 698^^^^^^^^^^^^^ 699 700This is a larger entry point for various types of install operations. The 701command has multiple subarguments, similar to --disk and friends. This 702option is strictly for VM install operations, essentially configuring the 703first boot. 704 705The simplest usage to ex: install fedora29 is: 706 707.. code-block:: 708 709 --install fedora29 710 711And virt-install will fetch a --location URL from libosinfo, and populate 712defaults from there. 713 714Available suboptions: 715 716``os=`` 717 This is os install option described above. The explicit way to specify that 718 would be ``--install os=fedora29`` . os= is the default option if none is 719 specified 720 721``kernel=``, ``initrd=`` 722 Specify a kernel and initrd pair to use as install media. They are copied 723 into a temporary location before booting the VM, so they can be combined 724 with --initrd-inject and your source media will not be altered. Media 725 will be uploaded to a remote connection if required. 726 727 Example case using local filesystem paths: 728 ``--install kernel=/path/to/kernel,initrd=/path/to/initrd`` 729 730 Example using network paths. Kernel/initrd will be downloaded locally first, 731 then passed to the VM as local filesystem paths: 732 ``--install kernel=https://127.0.0.1/tree/kernel,initrd=https://127.0.0.1/tree/initrd`` 733 734 Note, these are just for install time booting. If you want to set the kernel 735 used for permanent VM booting, use the ``--boot`` option. 736 737``kernel_args=``, ``kernel_args_overwrite=yes|no`` 738 Specify install time kernel arguments (libvirt <cmdline> XML). These can 739 be combine with ex: kernel/initrd options, or ``--location`` media. By 740 default, kernel_args is just like --extra-args, and will _append_ to 741 the arguments that virt-install will try to set by default for most 742 --location installs. If you want to override the virt-install default, 743 additionally specify kernel_args_overwrite=yes 744 745``bootdev=`` 746 Specify the install bootdev (hd, cdrom, floppy, network) to boot off of 747 for the install phase. This maps to libvirt <os><boot dev=X> XML. 748 749 If you want to install off a cdrom or network, it's probably simpler 750 and more backwards compatible to just use ``--cdrom`` or ``--pxe`` , but 751 this options gives fine grained control over the install process if 752 needed. 753 754``no_install=yes|no`` 755 Tell virt-install that there isn't actually any install happening, 756 and you just want to create the VM. ``--import`` is just an alias 757 for this, as is specifying ``--boot`` without any other install 758 options. The deprecated ``--live`` option is the same as 759 '--cdrom $ISO --install no_install=yes' 760 761 762 763``--reinstall DOMAIN`` 764^^^^^^^^^^^^^^^^^^^^^^ 765 766Reinstall an existing VM. DOMAIN can be a VM name, UUID, or ID number. 767virt-install will fetch the domain XML from libvirt, apply the specified 768install config changes, boot the VM for the install process, and then 769revert to roughly the same starting XML. 770 771Only install related options are processed, all other VM configuration 772options like --name, --disk, etc. are completely ignored. 773 774If --reinstall is used with --cdrom, an existing CDROM attached to 775the VM will be used if one is available, otherwise a permanent CDROM 776device will be added. 777 778 779 780``--unattended`` 781^^^^^^^^^^^^^^^^ 782 783**Syntax:** ``--unattended`` [OPTIONS] 784 785Perform an unattended install using libosinfo's install script support. 786This is essentially a database of auto install scripts for various 787distros: Red Hat kickstarts, Debian installer scripting, Windows 788unattended installs, and potentially others. The simplest invocation 789is to combine it with --install like: 790 791.. code-block:: 792 793 --install fedora29 --unattended 794 795A Windows install will look like 796 797.. code-block:: 798 799 --cdrom /path/to/my/windows.iso --unattended 800 801Sub options are: 802 803``profile=`` 804 Choose which libosinfo unattended profile to use. Most distros have 805 a 'desktop' and a 'jeos' profile. virt-install will default to 'desktop' 806 if this is unspecified. 807 808``admin-password-file=`` 809 A file used to set the VM OS admin/root password from. This option can 810 be used either as "admin-password-file=/path/to/password-file" or as 811 "admin-password-file=/dev/fd/n", being n the file descriptor of the 812 password-file. 813 Note that only the first line of the file will be considered, including 814 any whitespace characters and excluding new-line. 815 816``user-login=`` 817 The user login name to be used in th VM. virt-install will default to your 818 current host username if this is unspecified. 819 Note that when running virt-install as "root", this option must be specified. 820 821``user-password-file=`` 822 A file used to set the VM user password. This option can be used either as 823 "user-password-file=/path/to/password-file" or as 824 "user-password-file=/dev/fd/n", being n the file descriptor of the 825 password-file. The username is either the user-login specified or your current 826 host username. 827 Note that only the first line of the file will be considered, including 828 any whitespace characters and excluding new-line. 829 830``product-key=`` 831 Set a Windows product key 832 833 834 835``--cloud-init`` 836^^^^^^^^^^^^^^^^ 837 838Pass cloud-init metadata to the VM. A cloud-init NoCloud ISO file is generated, 839and attached to the VM as a CDROM device. The device is only attached for the 840first boot. This option is particularly useful for distro cloud images, which 841have locked login accounts by default; --cloud-init provides the means to 842initialize those login accounts, like setting a root password. 843 844The simplest invocation is just plain ``--cloud-init`` with no suboptions; 845this maps to ``--cloud-init root-password-generate=on,disable=on``. See those 846suboptions for explanation of how they work. 847 848Use --cloud-init=? to see a list of all available sub options. 849 850Sub options are: 851 852``root-password-generate=on`` 853 Generate a new root password for the VM. When used, virt-install will 854 print the generated password to the console, and pause for 10 seconds 855 to give the user a chance to notice it and copy it. 856 857``disable=on`` 858 Disable cloud-init in the VM for subsequent boots. Without this, 859 cloud-init may reset auth on each boot. 860 861``root-password-file=`` 862 A file used to set the VM root password from. This option can 863 be used either as "root-password-file=/path/to/password-file" or as 864 "root-password-file=/dev/fd/n", being n the file descriptor of the 865 password-file. 866 Note that only the first line of the file will be considered, including 867 any whitespace characters and excluding new-line. 868 869``meta-data=`` 870 Specify a cloud-init meta-data file to add directly to the iso. All other 871 meta-data configuration options on the --cloud-init command line are ignored. 872 873``user-data=`` 874 Specify a cloud-init user-data file to add directly to the iso. All other 875 user-data configuration options on the --cloud-init command line are ignored. 876 877``ssh-key=`` 878 Specify a public key to inject into the guest, providing ssh access to the 879 unprivileged account. Example: ssh-key=/home/user/.ssh/id_rsa.pub 880 881 882 883``--boot`` 884^^^^^^^^^^ 885 886**Syntax:** ``--boot`` BOOTOPTS 887 888Optionally specify the post-install VM boot configuration. This option allows 889specifying a boot device order, permanently booting off kernel/initrd with 890option kernel arguments, and enabling a BIOS boot menu (requires libvirt 8910.8.3 or later) 892 893--boot can be specified in addition to other install options 894(such as --location, --cdrom, etc.) or can be specified on its own. In 895the latter case, behavior is similar to the --import install option: there 896is no 'install' phase, the guest is just created and launched as specified. 897 898Some examples: 899 900``--boot cdrom,fd,hd,network`` 901 Set the boot device priority as first cdrom, first floppy, first harddisk, 902 network PXE boot. 903 904``--boot kernel=KERNEL,initrd=INITRD,kernel_args="console=/dev/ttyS0"`` 905 Have guest permanently boot off a local kernel/initrd pair, with the 906 specified kernel options. 907 908``--boot kernel=KERNEL,initrd=INITRD,dtb=DTB`` 909 Have guest permanently boot off a local kernel/initrd pair with an 910 external device tree binary. DTB can be required for some non-x86 911 configurations like ARM or PPC 912 913``--boot loader=BIOSPATH`` 914 Use BIOSPATH as the virtual machine BIOS. 915 916``--boot bootmenu.enable=on,bios.useserial=on`` 917 Enable the bios boot menu, and enable sending bios text output over 918 serial console. 919 920``--boot init=INITPATH`` 921 Path to a binary that the container guest will init. If a root ``--filesystem`` 922 has been specified, virt-install will default to /sbin/init, otherwise 923 will default to /bin/sh. 924 925``--boot uefi`` 926 Configure the VM to boot from UEFI. In order for virt-install to know the 927 correct UEFI parameters, libvirt needs to be advertising known UEFI binaries 928 via domcapabilities XML, so this will likely only work if using properly 929 configured distro packages. 930 931``--boot loader=/.../OVMF_CODE.fd,loader.readonly=yes,loader.type=pflash,nvram.template=/.../OVMF_VARS.fd,loader_secure=no`` 932 Specify that the virtual machine use the custom OVMF binary as boot firmware, 933 mapped as a virtual flash chip. In addition, request that libvirt instantiate 934 the VM-specific UEFI varstore from the custom "/.../OVMF_VARS.fd" varstore 935 template. This is the recommended UEFI setup, and should be used if 936 --boot uefi doesn't know about your UEFI binaries. If your UEFI firmware 937 supports Secure boot feature you can enable it via loader_secure. 938 939Use --boot=? to see a list of all available sub options. 940Complete details at https://libvirt.org/formatdomain.html#elementsOS 941 942 943 944``--idmap`` 945^^^^^^^^^^^ 946 947**Syntax:** ``--idmap`` OPTIONS 948 949If the guest configuration declares a UID or GID mapping, 950the 'user' namespace will be enabled to apply these. 951A suitably configured UID/GID mapping is a pre-requisite to 952make containers secure, in the absence of sVirt confinement. 953 954--idmap can be specified to enable user namespace for LXC containers. Example: 955 956.. code-block:: 957 958 --idmap uid.start=0,uid.target=1000,uid.count=10,gid.start=0,gid.target=1000,gid.count=10 959 960Use --idmap=? to see a list of all available sub options. 961Complete details at https://libvirt.org/formatdomain.html#elementsOSContainer 962 963 964 965GUEST OS OPTIONS 966================ 967 968 969``--os-variant``, ``--osinfo`` 970^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 971 972**Syntax:** ``--os-variant`` [OS_VARIANT|OPT1=VAL1,...] 973 974Optimize the guest configuration for a specific operating system (ex. 975'fedora29', 'rhel7', 'win10'). While not required, specifying this 976options is HIGHLY RECOMMENDED, as it can greatly increase performance 977by specifying virtio among other guest tweaks. 978 979The simplest usage is ``--os-variant OS-NAME``, for example 980``--os-variant fedora32``. ``--os-variant`` supports explicit suboption 981syntax as well: 982 983``name=``, ``short-id=`` 984 The OS name/short-id from libosinfo. Examples: ``fedora32``, ``win10`` 985 986``id=`` 987 The full URL style libosinfo ID. For example, ``name=win10`` is 988 the same as ``id=http://microsoft.com/win/10`` 989 990``detect=on|off`` 991 Whether virt-install should attempt OS detection from the specified 992 install media. Detection is presently only attempted for URL and 993 CDROM installs, and is not 100% reliable. 994 995``require=on|off`` 996 If ``on``, virt-install errors if no OS value is set or detected. 997 998 999Some interesting examples: 1000 1001``--os-variant detect=on,require=on`` 1002 This tells virt-install to attempt detection from install media, 1003 but explicitly fail if that does not succeed. This will ensure 1004 your virt-install invocations don't fallback to a poorly performing 1005 config 1006 1007``--os-variant detect=on,name=OSNAME`` 1008 Attempt OS detection from install media, but if that fails, use 1009 OSNAME as a fallback. 1010 1011 1012By default, virt-install will do ``--os-variant detect=on,name=generic``, 1013using the detected OS if found, and falling back to the stub ``generic`` 1014value otherwise, and printing a warning. 1015 1016If any manual ``--os-variant`` value is specified, the default is 1017all settings off or unset. 1018 1019Use the command "osinfo-query os" to get the list of the accepted OS 1020variant names. 1021 1022 1023 1024STORAGE OPTIONS 1025=============== 1026 1027 1028``--disk`` 1029^^^^^^^^^^ 1030 1031**Syntax:** ``--disk`` OPTIONS 1032 1033Specifies media to use as storage for the guest, with various options. The 1034general format of a disk string is 1035 1036.. code-block:: 1037 1038 --disk opt1=val1,opt2=val2,... 1039 1040The simplest invocation to create a new 10G disk image and associated disk device: 1041 1042.. code-block:: 1043 1044 --disk size=10 1045 1046virt-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: 1047 1048.. code-block:: 1049 1050 --disk /some/storage/path[,opt1=val1]... 1051 1052or explicitly specify one of the following arguments: 1053 1054``path`` 1055 A path to some storage media to use, existing or not. Existing media can be 1056 a file or block device. 1057 1058 Specifying a non-existent path implies attempting to create the new storage, 1059 and will require specifying a 'size' value. Even for remote hosts, virt-install 1060 will try to use libvirt storage APIs to automatically create the given path. 1061 1062 If the hypervisor supports it, ``path`` can also be a network URL, like 1063 https://example.com/some-disk.img . For network paths, they hypervisor will 1064 directly access the storage, nothing is downloaded locally. 1065 1066``pool`` 1067 An existing libvirt storage pool name to create new storage on. Requires 1068 specifying a 'size' value. 1069 1070``vol`` 1071 An existing libvirt storage volume to use. This is specified as 1072 'poolname/volname'. 1073 1074 1075Options that apply to storage creation: 1076 1077``size`` 1078 size (in GiB) to use if creating new storage 1079 1080``sparse`` 1081 whether to skip fully allocating newly created storage. Value is 'yes' or 1082 'no'. Default is 'yes' (do not fully allocate) unless it isn't 1083 supported by the underlying storage type. 1084 1085 The initial time taken to fully-allocate the guest virtual disk (sparse=no) 1086 will be usually balanced by faster install times inside the guest. Thus 1087 use of this option is recommended to ensure consistently high performance 1088 and to avoid I/O errors in the guest should the host filesystem fill up. 1089 1090``format`` 1091 Disk image format. For file volumes, this can be 'raw', 'qcow2', 'vmdk', etc. 1092 See format types in https://libvirt.org/storage.html for possible values. 1093 This is often mapped to the ``driver_type`` value as well. 1094 1095 If not specified when creating file images, this will default to 'qcow2'. 1096 1097 If creating storage, this will be the format of the new image. 1098 If using an existing image, this overrides libvirt's format auto-detection. 1099 1100``backing_store`` 1101 Path to a disk to use as the backing store for the newly created image. 1102 1103``backing_format`` 1104 Disk image format of ``backing_store`` 1105 1106Some example device configuration suboptions: 1107 1108``device`` 1109 Disk device type. Example values are be 'cdrom', 'disk', 'lun' or 'floppy'. 1110 The default is 'disk'. 1111 1112``boot.order`` 1113 Guest installation with multiple disks will need this parameter to boot 1114 correctly after being installed. A boot.order parameter will take values 1,2,3,... 1115 Devices with lower value has higher priority. 1116 This option applies to other bootable device types as well. 1117 1118``target.bus** or *bus`` 1119 Disk bus type. Example values are be 'ide', 'sata', 'scsi', 'usb', 'virtio' or 'xen'. 1120 The default is hypervisor dependent since not all hypervisors support all 1121 bus types. 1122 1123``readonly`` 1124 Set drive as readonly (takes 'on' or 'off') 1125 1126``shareable`` 1127 Set drive as shareable (takes 'on' or 'off') 1128 1129``cache`` 1130 The cache mode to be used. The host pagecache provides cache memory. 1131 The cache value can be 'none', 'writethrough', 'directsync', 'unsafe' 1132 or 'writeback'. 1133 'writethrough' provides read caching. 'writeback' provides 1134 read and write caching. 'directsync' bypasses the host page 1135 cache. 'unsafe' may cache all content and ignore flush requests from 1136 the guest. 1137 1138``driver.discard`` 1139 Whether discard (also known as "trim" or "unmap") requests are ignored 1140 or passed to the filesystem. The value can be either "unmap" (allow 1141 the discard request to be passed) or "ignore" (ignore the discard 1142 request). Since 1.0.6 (QEMU and KVM only) 1143 1144``driver.name`` 1145 Driver name the hypervisor should use when accessing the specified 1146 storage. Typically does not need to be set by the user. 1147 1148``driver.type`` 1149 Driver format/type the hypervisor should use when accessing the specified 1150 storage. Typically does not need to be set by the user. 1151 1152``driver.io`` 1153 Disk IO backend. Can be either "threads", "native" or "io_uring". 1154 1155``driver.error_policy`` 1156 How guest should react if a write error is encountered. Can be one of 1157 "stop", "ignore", or "enospace" 1158 1159``serial`` 1160 Serial number of the emulated disk device. This is used in linux guests 1161 to set /dev/disk/by-id symlinks. An example serial number might be: 1162 WD-WMAP9A966149 1163 1164``source.startupPolicy`` 1165 It defines what to do with the disk if the source file is not accessible. 1166 1167``snapshot`` 1168 Defines default behavior of the disk during disk snapshots. 1169 1170See the examples section for some uses. This option deprecates -f/--file, 1171-s/--file-size, --nonsparse, and --nodisks. 1172 1173Use --disk=? to see a list of all available sub options. 1174Complete details at https://libvirt.org/formatdomain.html#elementsDisks 1175 1176 1177 1178``--filesystem`` 1179^^^^^^^^^^^^^^^^ 1180 1181Specifies a directory on the host to export to the guest. The most simple 1182invocation is: 1183 1184.. code-block:: 1185 1186 --filesystem /source/on/host,/target/point/in/guest 1187 1188Which will work for recent QEMU and linux guest OS or LXC containers. For 1189QEMU, the target point is just a mounting hint in sysfs, so will not be 1190automatically mounted. 1191 1192Some example suboptions: 1193 1194``type`` 1195 The type or the source directory. Valid values are 'mount' (the default) or 1196 'template' for OpenVZ templates. 1197 1198``accessmode`` or ``mode`` 1199 The access mode for the source directory from the guest OS. Only used with 1200 QEMU and type=mount. Valid modes are 'passthrough' (the default), 'mapped', 1201 or 'squash'. See libvirt domain XML documentation for more info. 1202 1203``source`` 1204 The directory on the host to share. 1205 1206``target`` 1207 The mount location to use in the guest. 1208 1209Use --filesystem=? to see a list of all available sub options. 1210Complete details at https://libvirt.org/formatdomain.html#elementsFilesystems 1211 1212 1213 1214NETWORKING OPTIONS 1215================== 1216 1217 1218``-w``, ``--network`` 1219^^^^^^^^^^^^^^^^^^^^^ 1220 1221**Syntax:** ``-w``, ``--network`` OPTIONS 1222 1223Connect the guest to the host network. Examples for specifying the network type: 1224 1225``bridge=BRIDGE`` 1226 Connect to a bridge device in the host called ``BRIDGE``. Use this option if 1227 the host has static networking config & the guest requires full outbound 1228 and inbound connectivity to/from the LAN. Also use this if live migration 1229 will be used with this guest. 1230 1231``network=NAME`` 1232 Connect to a virtual network in the host called ``NAME``. Virtual networks 1233 can be listed, created, deleted using the ``virsh`` command line tool. In 1234 an unmodified install of ``libvirt`` there is usually a virtual network 1235 with a name of ``default``. Use a virtual network if the host has dynamic 1236 networking (eg NetworkManager), or using wireless. The guest will be 1237 NATed to the LAN by whichever connection is active. 1238 1239``type=direct,source=IFACE[,source.mode=MODE]`` 1240 Direct connect to host interface IFACE using macvtap. 1241 1242``user`` 1243 Connect to the LAN using SLIRP. Only use this if running a QEMU guest as 1244 an unprivileged user. This provides a very limited form of NAT. 1245 1246``none`` 1247 Tell virt-install not to add any default network interface. 1248 1249If ``--network`` is omitted a single NIC will be created in the guest. If 1250there is a bridge device in the host with a physical interface attached, 1251that will be used for connectivity. Failing that, the virtual network 1252called ``default`` will be used. This option can be specified multiple 1253times to setup more than one NIC. 1254 1255Some example suboptions: 1256 1257``model.type`` or ``model`` 1258 Network device model as seen by the guest. Value can be any nic model supported 1259 by the hypervisor, e.g.: 'e1000', 'rtl8139', 'virtio', ... 1260 1261``mac.address`` or ``mac`` 1262 Fixed MAC address for the guest; If this parameter is omitted, or the value 1263 ``RANDOM`` is specified a suitable address will be randomly generated. For 1264 Xen virtual machines it is required that the first 3 pairs in the MAC address 1265 be the sequence '00:16:3e', while for QEMU or KVM virtual machines it must 1266 be '52:54:00'. 1267 1268``filterref.filter`` 1269 Controlling firewall and network filtering in libvirt. Value can be any nwfilter 1270 defined by the ``virsh`` 'nwfilter' subcommands. Available filters can be listed 1271 by running 'virsh nwfilter-list', e.g.: 'clean-traffic', 'no-mac-spoofing', ... 1272 1273``virtualport.*`` options 1274 Configure the device virtual port profile. This is used for 802.Qbg, 802.Qbh, 1275 midonet, and openvswitch config. 1276 1277 Use --network=? to see a list of all available sub options. 1278 Complete details at https://libvirt.org/formatdomain.html#elementsNICS 1279 1280 This option deprecates -m/--mac, -b/--bridge, and --nonetworks 1281 1282 1283 1284GRAPHICS OPTIONS 1285================ 1286 1287If no graphics option is specified, ``virt-install`` will try to select 1288the appropriate graphics if the DISPLAY environment variable is set, 1289otherwise '--graphics none' is used. 1290 1291 1292 1293``--graphics`` 1294^^^^^^^^^^^^^^ 1295 1296**Syntax:** ``--graphics`` TYPE,opt1=arg1,opt2=arg2,... 1297 1298Specifies the graphical display configuration. This does not configure any 1299virtual hardware, just how the guest's graphical display can be accessed. 1300Typically the user does not need to specify this option, virt-install will 1301try and choose a useful default, and launch a suitable connection. 1302 1303General format of a graphical string is 1304 1305.. code-block:: 1306 1307 --graphics TYPE,opt1=arg1,opt2=arg2,... 1308 1309For example: 1310 1311.. code-block:: 1312 1313 --graphics vnc,password=foobar 1314 1315Some supported TYPE values: 1316 1317``vnc`` 1318 Setup a virtual console in the guest and export it as a VNC server in 1319 the host. Unless the ``port`` parameter is also provided, the VNC 1320 server will run on the first free port number at 5900 or above. The 1321 actual VNC display allocated can be obtained using the ``vncdisplay`` 1322 command to ``virsh`` (or virt-viewer(1) can be used which handles this 1323 detail for the use). 1324 1325``spice`` 1326 Export the guest's console using the Spice protocol. Spice allows advanced 1327 features like audio and USB device streaming, as well as improved graphical 1328 performance. 1329 1330 Using spice graphic type will work as if those arguments were given: 1331 1332 .. code-block:: 1333 1334 --video qxl --channel spicevmc 1335 1336``none`` 1337 No graphical console will be allocated for the guest. Guests will likely 1338 need to have a text console configured on the first 1339 serial port in the guest (this can be done via the --extra-args option). The 1340 command 'virsh console NAME' can be used to connect to the serial device. 1341 1342 1343Some supported suboptions: 1344 1345``port`` 1346 Request a permanent, statically assigned port number for the guest 1347 console. This is used by 'vnc' and 'spice' 1348 1349``tlsPort`` 1350 Specify the spice tlsport. 1351 1352``websocket`` 1353 Request a VNC WebSocket port for the guest console. 1354 1355 If -1 is specified, the WebSocket port is auto-allocated. 1356 1357 This is used by 'vnc' and 'spice' 1358 1359``listen`` 1360 Address to listen on for VNC/Spice connections. Default is typically 127.0.0.1 1361 (localhost only), but some hypervisors allow changing this globally (for 1362 example, the qemu driver default can be changed in /etc/libvirt/qemu.conf). 1363 Use 0.0.0.0 to allow access from other machines. 1364 1365 Use 'none' to specify that the display server should not listen on any 1366 port. The display server can be accessed only locally through 1367 libvirt unix socket (virt-viewer with --attach for instance). 1368 1369 Use 'socket' to have the VM listen on a libvirt generated unix socket 1370 path on the host filesystem. 1371 1372 This is used by 'vnc' and 'spice' 1373 1374``password`` 1375 Request a console password, required at connection time. Beware, this info may 1376 end up in virt-install log files, so don't use an important password. This 1377 is used by 'vnc' and 'spice' 1378 1379``gl.enable`` 1380 Whether to use OpenGL accelerated rendering. Value is 'yes' or 'no'. This is 1381 used by 'spice'. 1382 1383``gl.rendernode`` 1384 DRM render node path to use. This is used when 'gl' is enabled. 1385 1386Use --graphics=? to see a list of all available sub options. 1387Complete details at https://libvirt.org/formatdomain.html#elementsGraphics 1388 1389This deprecates the following options: 1390--vnc, --vncport, --vnclisten, -k/--keymap, --sdl, --nographics 1391 1392 1393 1394``--autoconsole`` 1395^^^^^^^^^^^^^^^^^ 1396 1397**Syntax:** ``--autoconsole`` OPTIONS 1398 1399Configure what interactive console virt-install will launch for the VM. This 1400option is not required; the default behavior is adaptive and dependent on 1401how the VM is configured. But you can use this option to override the default 1402choice. 1403 1404``--autoconsole graphical`` 1405 Use the graphical virt-viewer(1) as the interactive console 1406 1407``--autoconsole text`` 1408 Use the text mode ``virsh console`` as the interactive console. 1409 1410``--autoconsole none`` 1411 This is the same as ``--noautoconsole`` 1412 1413``--noautoconsole`` 1414 Don't automatically try to connect to the guest console. Same as 1415 ``--autoconsole none`` 1416 1417Note, virt-install exits quickly when this option is specified. If your 1418command requested a multistep install, like --cdrom or --location, after 1419the install phase is complete the VM will be shutoff, regardless of 1420whether a reboot was requested in the VM. If you want the VM to be 1421rebooted, virt-install must remain running. You can use '--wait' to keep 1422virt-install alive even if --noautoconsole is specified. 1423 1424 1425 1426VIRTUALIZATION OPTIONS 1427====================== 1428 1429Options to override the default virtualization type choices. 1430 1431 1432``-v``, ``--hvm`` 1433^^^^^^^^^^^^^^^^^ 1434 1435Request the use of full virtualization, if both para & full virtualization are 1436available on the host. This parameter may not be available if connecting to a 1437Xen hypervisor on a machine without hardware virtualization support. This 1438parameter is implied if connecting to a QEMU based hypervisor. 1439 1440 1441``-p``, ``--paravirt`` 1442^^^^^^^^^^^^^^^^^^^^^^ 1443 1444This guest should be a paravirtualized guest. If the host supports both 1445para & full virtualization, and neither this parameter nor the ``--hvm`` 1446are specified, this will be assumed. 1447 1448 1449``--container`` 1450^^^^^^^^^^^^^^^ 1451 1452This guest should be a container type guest. This option is only required 1453if the hypervisor supports other guest types as well (so for example this 1454option is the default behavior for LXC and OpenVZ, but is provided for 1455completeness). 1456 1457 1458``--virt-type`` 1459^^^^^^^^^^^^^^^ 1460 1461The hypervisor to install on. Example choices are kvm, qemu, or xen. 1462Available options are listed via 'virsh capabilities' in the <domain> tags. 1463 1464This deprecates the --accelerate option, which is now the default behavior. 1465To install a plain QEMU guest, use '--virt-type qemu' 1466 1467 1468 1469DEVICE OPTIONS 1470============== 1471 1472All devices have a set of ``address.*`` options for configuring the 1473particulars of the device's address on its parent controller or bus. 1474See ``https://libvirt.org/formatdomain.html#elementsAddress`` for details. 1475 1476 1477 1478``--controller`` 1479^^^^^^^^^^^^^^^^ 1480 1481**Syntax:** ``--controller`` OPTIONS 1482 1483Attach a controller device to the guest. TYPE is one of: 1484``ide``, ``fdc``, ``scsi``, ``sata``, ``virtio-serial``, or ``usb`` . 1485 1486Controller also supports the special values ``usb2`` and ``usb3`` to 1487specify which version of the USB controller should be used (version 2 1488or 3). 1489 1490Some example suboptions: 1491 1492``model`` 1493 Controller model. These may vary according to the hypervisor and its 1494 version. Most commonly used models are e.g. ``auto`` , ``virtio-scsi`` 1495 for the ``scsi`` controller, ``ehci`` or ``none``for the ``usb`` 1496 controller. 1497 1498Use --controller=? to see a list of all available sub options. 1499Complete details at https://libvirt.org/formatdomain.html#elementsControllers 1500 1501 1502 1503``--input`` 1504^^^^^^^^^^^ 1505 1506**Syntax:** ``--input`` OPTIONS 1507 1508Attach an input device to the guest. Example input device types are mouse, tablet, or keyboard. 1509 1510Use --input=? to see a list of all available sub options. 1511Complete details at https://libvirt.org/formatdomain.html#elementsInput 1512 1513 1514 1515``--hostdev``, ``--host-device`` 1516^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1517 1518**Syntax:** ``--hostdev``, ``--host-device`` OPTIONS 1519 1520Attach a physical host device to the guest. Some example values for HOSTDEV: 1521 1522``--hostdev pci_0000_00_1b_0`` 1523 A node device name via libvirt, as shown by 'virsh nodedev-list' 1524 1525``--hostdev 001.003`` 1526 USB by bus, device (via lsusb). 1527 1528``--hostdev 0x1234:0x5678`` 1529 USB by vendor, product (via lsusb). 1530 1531``--hostdev 1f.01.02`` 1532 PCI device (via lspci). 1533 1534``--hostdev wlan0,type=net`` 1535 Network device (in LXC container). 1536 1537``--hostdev /dev/net/tun,type=misc`` 1538 Character device (in LXC container). 1539 1540``--hostdev /dev/sdf,type=storage`` 1541 Block device (in LXC container). 1542 1543Use --hostdev=? to see a list of all available sub options. 1544Complete details at https://libvirt.org/formatdomain.html#elementsHostDev 1545 1546 1547 1548``--sound`` 1549^^^^^^^^^^^ 1550 1551**Syntax:** ``--sound`` MODEL 1552 1553Attach a virtual audio device to the guest. MODEL specifies the emulated 1554sound card model. Possible values are ich6, ich9, ac97, es1370, sb16, pcspk, 1555or default. 'default' will try to pick the best model that the specified 1556OS supports. 1557 1558This deprecates the old --soundhw option. 1559Use --sound=? to see a list of all available sub options. 1560Complete details at https://libvirt.org/formatdomain.html#elementsSound 1561 1562 1563 1564``--watchdog`` 1565^^^^^^^^^^^^^^ 1566 1567**Syntax:** ``--watchdog`` MODEL[,action=ACTION] 1568 1569Attach a virtual hardware watchdog device to the guest. This requires a 1570daemon and device driver in the guest. The watchdog fires a signal when 1571the virtual machine appears to hung. ACTION specifies what libvirt will do 1572when the watchdog fires. Values are 1573 1574``reset`` 1575 Forcefully reset the guest (the default) 1576 1577``poweroff`` 1578 Forcefully power off the guest 1579 1580``pause`` 1581 Pause the guest 1582 1583``none`` 1584 Do nothing 1585 1586``shutdown`` 1587 Gracefully shutdown the guest (not recommended, since a hung guest probably 1588 won't respond to a graceful shutdown) 1589 1590MODEL is the emulated device model: either i6300esb (the default) or ib700. 1591Some examples: 1592 1593``--watchdog default`` 1594 Use the recommended settings 1595 1596``--watchdog i6300esb,action=poweroff`` 1597 Use the i6300esb with the 'poweroff' action 1598 1599Use --watchdog=? to see a list of all available sub options. 1600Complete details at https://libvirt.org/formatdomain.html#elementsWatchdog 1601 1602 1603 1604``--serial`` 1605^^^^^^^^^^^^ 1606 1607**Syntax:** ``--serial`` OPTIONS 1608 1609Specifies a serial device to attach to the guest, with various options. The 1610general format of a serial string is 1611 1612.. code-block:: 1613 1614 --serial type,opt1=val1,opt2=val2,... 1615 1616--serial and --parallel devices share all the same options, unless otherwise 1617noted. Some of the types of character device redirection are: 1618 1619``--serial pty`` 1620 Pseudo TTY. The allocated pty will be listed in the running guests XML 1621 description. 1622 1623``--serial dev,path=HOSTPATH`` 1624 Host device. For serial devices, this could be /dev/ttyS0. For parallel 1625 devices, this could be /dev/parport0. 1626 1627``--serial file,path=FILENAME`` 1628 Write output to FILENAME. 1629 1630``--serial tcp,host=HOST:PORT,source.mode=MODE,protocol.type=PROTOCOL`` 1631 TCP net console. MODE is either 'bind' (wait for connections on HOST:PORT) 1632 or 'connect' (send output to HOST:PORT), default is 'bind'. HOST defaults 1633 to '127.0.0.1', but PORT is required. PROTOCOL can be either 'raw' or 'telnet' 1634 (default 'raw'). If 'telnet', the port acts like a telnet server or client. 1635 Some examples: 1636 1637 Wait for connections on any address, port 4567: 1638 1639 --serial tcp,host=0.0.0.0:4567 1640 1641 Connect to localhost, port 1234: 1642 1643 --serial tcp,host=:1234,source.mode=connect 1644 1645 Wait for telnet connection on localhost, port 2222. The user could then 1646 connect interactively to this console via 'telnet localhost 2222': 1647 1648 --serial tcp,host=:2222,source.mode=bind,source.protocol=telnet 1649 1650``--serial udp,host=CONNECT_HOST:PORT,bind_host=BIND_HOST:BIND_PORT`` 1651 UDP net console. HOST:PORT is the destination to send output to (default 1652 HOST is '127.0.0.1', PORT is required). BIND_HOST:BIND_PORT is the optional 1653 local address to bind to (default BIND_HOST is 127.0.0.1, but is only set if 1654 BIND_PORT is specified). Some examples: 1655 1656 Send output to default syslog port (may need to edit /etc/rsyslog.conf 1657 accordingly): 1658 1659 --serial udp,host=:514 1660 1661 Send output to remote host 192.168.10.20, port 4444 (this output can be 1662 read on the remote host using 'nc -u -l 4444'): 1663 1664 --serial udp,host=192.168.10.20:4444 1665 1666``--serial unix,path=UNIXPATH,mode=MODE`` 1667 Unix socket, see unix(7). MODE has similar behavior and defaults as 1668 --serial tcp,mode=MODE 1669 1670Use --serial=? to see a list of all available sub options. 1671Complete details at https://libvirt.org/formatdomain.html#elementsCharSerial 1672 1673 1674 1675``--parallel`` 1676^^^^^^^^^^^^^^ 1677 1678**Syntax:** ``--parallel`` OPTIONS 1679 1680Specify a parallel device. The format and options are largely identical 1681to ``serial`` 1682 1683Use --parallel=? to see a list of all available sub options. 1684Complete details at https://libvirt.org/formatdomain.html#elementsCharParallel 1685 1686 1687 1688``--channel`` 1689^^^^^^^^^^^^^ 1690 1691Specifies a communication channel device to connect the guest and host 1692machine. This option uses the same options as --serial and --parallel 1693for specifying the host/source end of the channel. Extra 'target' options 1694are used to specify how the guest machine sees the channel. 1695 1696Some of the types of character device redirection are: 1697 1698``--channel SOURCE,target.type=guestfwd,target.address=HOST:PORT`` 1699 Communication channel using QEMU usermode networking stack. The guest can 1700 connect to the channel using the specified HOST:PORT combination. 1701 1702``--channel SOURCE,target.type=virtio[,target.name=NAME]`` 1703 Communication channel using virtio serial (requires 2.6.34 or later host and 1704 guest). Each instance of a virtio --channel line is exposed in the 1705 guest as /dev/vport0p1, /dev/vport0p2, etc. NAME is optional metadata, and 1706 can be any string, such as org.linux-kvm.virtioport1. 1707 If specified, this will be exposed in the guest at 1708 /sys/class/virtio-ports/vport0p1/NAME 1709 1710``--channel spicevmc,target.type=virtio[,target.name=NAME]`` 1711 Communication channel for QEMU spice agent, using virtio serial 1712 (requires 2.6.34 or later host and guest). NAME is optional metadata, 1713 and can be any string, such as the default com.redhat.spice.0 that 1714 specifies how the guest will see the channel. 1715 1716 1717Use --channel=? to see a list of all available sub options. 1718Complete details at https://libvirt.org/formatdomain.html#elementsCharChannel 1719 1720 1721 1722``--console`` 1723^^^^^^^^^^^^^ 1724 1725Connect a text console between the guest and host. Certain guest and 1726hypervisor combinations can automatically set up a getty in the guest, so 1727an out of the box text login can be provided (target_type=xen for xen 1728paravirt guests, and possibly target_type=virtio in the future). 1729 1730Example: 1731 1732``--console pty,target.type=virtio`` 1733 Connect a virtio console to the guest, redirected to a PTY on the host. 1734 For supported guests, this exposes /dev/hvc0 in the guest. See 1735 https://fedoraproject.org/wiki/Features/VirtioSerial for more info. virtio 1736 console requires libvirt 0.8.3 or later. 1737 1738 1739Use --console=? to see a list of all available sub options. 1740Complete details at https://libvirt.org/formatdomain.html#elementsCharConsole 1741 1742 1743 1744``--video`` 1745^^^^^^^^^^^ 1746 1747**Syntax:** ``--video`` OPTIONS 1748 1749Specify what video device model will be attached to the guest. Valid values 1750for VIDEO are hypervisor specific, but some options for recent kvm are 1751cirrus, vga, qxl, virtio, or vmvga (vmware). 1752Use --video=? to see a list of all available sub options. 1753Complete details at https://libvirt.org/formatdomain.html#elementsVideo 1754 1755 1756 1757``--smartcard`` 1758^^^^^^^^^^^^^^^ 1759 1760**Syntax:** ``--smartcard`` MODE[,OPTIONS] 1761 1762Configure a virtual smartcard device. 1763 1764Example MODE values are ``host``, ``host-certificates``, or ``passthrough``. 1765Example suboptions include: 1766 1767``type`` 1768 Character device type to connect to on the host. This is only applicable 1769 for ``passthrough`` mode. 1770 1771An example invocation: 1772 1773``--smartcard passthrough,type=spicevmc`` 1774 Use the smartcard channel of a SPICE graphics device to pass smartcard info 1775 to the guest 1776 1777Use --smartcard=? to see a list of all available sub options. 1778Complete details at https://libvirt.org/formatdomain.html#elementsSmartcard 1779 1780 1781 1782``--redirdev`` 1783^^^^^^^^^^^^^^ 1784 1785**Syntax:** ``--redirdev`` BUS[,OPTIONS] 1786 1787Add a redirected device. Example suboptions: 1788 1789``type`` 1790 The redirection type, currently supported is ``tcp`` or ``spicevmc`` . 1791 1792``server`` 1793 The TCP server connection details, of the form 'server:port'. 1794 1795Examples invocations: 1796 1797``--redirdev usb,type=tcp,server=localhost:4000`` 1798 Add a USB redirected device provided by the TCP server on 'localhost' 1799 port 4000. 1800 1801``--redirdev usb,type=spicevmc`` 1802 Add a USB device redirected via a dedicated Spice channel. 1803 1804 1805Use --redirdev=? to see a list of all available sub options. 1806Complete details at https://libvirt.org/formatdomain.html#elementsRedir 1807 1808 1809 1810``--memballoon`` 1811^^^^^^^^^^^^^^^^ 1812 1813**Syntax:** ``--memballoon`` MODEL[,OPTIONS] 1814 1815Attach a virtual memory balloon device to the guest. If the memballoon device 1816needs to be explicitly disabled, MODEL='none' is used. 1817 1818MODEL is the type of memballoon device provided. The value can be 'virtio', 1819'xen' or 'none'. Some examples: 1820 1821``--memballoon virtio`` 1822 Explicitly create a 'virtio' memballoon device 1823 1824``--memballoon none`` 1825 Disable the memballoon device 1826 1827Use --memballoon=? to see a list of all available sub options. 1828Complete details at https://libvirt.org/formatdomain.html#elementsMemBalloon 1829 1830 1831 1832``--tpm`` 1833^^^^^^^^^ 1834 1835**Syntax:** ``--tpm`` TYPE[,OPTIONS] 1836 1837Configure a virtual TPM device. Examples: 1838 1839``--tpm /dev/tpm`` 1840 Convenience option for passing through the hosts TPM. 1841 1842``--tpm emulator`` 1843 Request an emulated TPM device. 1844 1845Use --tpm=? to see a list of all available sub options. 1846Complete details at https://libvirt.org/formatdomain.html#elementsTpm 1847 1848 1849 1850``--rng`` 1851^^^^^^^^^ 1852 1853**Syntax:** ``--rng`` TYPE[,OPTIONS] 1854 1855Configure a virtual RNG device. 1856 1857Example TYPE values include ``random``, ``egd`` or ``builtin``. 1858 1859Example invocations: 1860 1861``--rng /dev/urandom`` 1862 Use the /dev/urandom device to get entropy data, this form implicitly uses the 1863 "random" model. 1864 1865``--rng builtin`` 1866 Use the builtin rng device to get entropy data. 1867 1868``--rng egd,backend.source.host=localhost,backend.source.service=8000,backend.type=tcp`` 1869 Connect to localhost to the TCP port 8000 to get entropy data. 1870 1871Use --rng=? to see a list of all available sub options. 1872Complete details at https://libvirt.org/formatdomain.html#elementsRng 1873 1874 1875 1876``--panic`` 1877^^^^^^^^^^^ 1878 1879**Syntax:** ``--panic`` MODEL[,OPTS] 1880 1881Attach a panic notifier device to the guest. 1882For the recommended settings, use: ``--panic default`` 1883 1884Use --panic=? to see a list of all available sub options. 1885Complete details at https://libvirt.org/formatdomain.html#elementsPanic 1886 1887 1888 1889``--memdev`` 1890^^^^^^^^^^^^ 1891 1892**Syntax:** ``--memdev`` OPTS 1893 1894Add a memory module to a guest which can be hotunplugged. To add a memdev you need 1895to configure hotplugmemory and NUMA for a guest. 1896 1897Use --memdev=? to see a list of all available sub options. 1898Complete details at https://libvirt.org/formatdomain.html#elementsMemory. 1899 1900 1901 1902``--vsock`` 1903^^^^^^^^^^^ 1904 1905**Syntax:** ``--vsock`` OPTS 1906 1907Configure a vsock host/guest interface. A typical configuration would be 1908 1909.. code-block:: 1910 1911 --vsock cid.auto=yes 1912 1913Use --vsock=? to see a list of all available sub options. 1914Complete details at https://libvirt.org/formatdomain.html#vsock. 1915 1916 1917 1918``--iommu`` 1919^^^^^^^^^^^ 1920 1921**Syntax:** ``--iommu`` MODEL[,OPTS] 1922 1923Add an IOMMU device to the guest. 1924 1925Use --iommu=? to see a list of all available options. 1926Complete details at https://libvirt.org/formatdomain.html#elementsIommu. 1927 1928 1929 1930 1931MISCELLANEOUS OPTIONS 1932===================== 1933 1934 1935``-h``, ``--help`` 1936^^^^^^^^^^^^^^^^^^ 1937 1938Show the help message and exit 1939 1940 1941 1942``--version`` 1943^^^^^^^^^^^^^ 1944 1945Show program's version number and exit 1946 1947 1948 1949``--autostart`` 1950^^^^^^^^^^^^^^^ 1951 1952Set the autostart flag for a domain. This causes the domain to be started 1953on host boot up. 1954 1955 1956 1957``--transient`` 1958^^^^^^^^^^^^^^^ 1959 1960Use --import or --boot and --transient if you want a transient libvirt 1961VM. These VMs exist only until the domain is shut down or the host 1962server is restarted. Libvirt forgets the XML configuration of the VM 1963after either of these events. Note that the VM's disks will not be 1964deleted. See: 1965https://wiki.libvirt.org/page/VM_lifecycle#Transient_guest_domains_vs_Persistent_guest_domains 1966 1967 1968 1969``--destroy-on-exit`` 1970^^^^^^^^^^^^^^^^^^^^^ 1971 1972When the VM console window is exited, destroy (force poweroff) the VM. 1973If you combine this with --transient, this makes the virt-install command 1974work similar to qemu, where the VM is shutdown when the console window 1975is closed by the user. 1976 1977 1978 1979``--print-xml`` 1980^^^^^^^^^^^^^^^ 1981 1982**Syntax:** ``--print-xml`` [STEP] 1983 1984Print the generated XML of the guest, instead of defining it. By default this 1985WILL do storage creation (can be disabled with --dry-run). This option implies --quiet. 1986 1987If the VM install has multiple phases, by default this will print all 1988generated XML. If you want to print a particular step, use --print-xml 2 1989(for the second phase XML). 1990 1991 1992 1993``--noreboot`` 1994^^^^^^^^^^^^^^ 1995 1996Prevent the domain from automatically rebooting after the install has 1997completed. 1998 1999 2000 2001``--wait`` 2002^^^^^^^^^^ 2003 2004**Syntax:** ``--wait`` WAIT 2005 2006Configure how virt-install will wait for the install to complete. 2007Without this option, virt-install will wait for the console to close (not 2008necessarily indicating the guest has shutdown), or in the case of 2009--noautoconsole, simply kick off the install and exit. 2010 2011Bare '--wait' or any negative value will make virt-install wait indefinitely. 2012Any positive number is the number of minutes virt-install will wait. If the 2013time limit is exceeded, virt-install simply exits, leaving the virtual machine 2014in its current state. 2015 2016 2017 2018``--dry-run`` 2019^^^^^^^^^^^^^ 2020 2021Proceed through the guest creation process, but do NOT create storage devices, 2022change host device configuration, or actually teach libvirt about the guest. 2023virt-install may still fetch install media, since this is required to 2024properly detect the OS to install. 2025 2026 2027 2028``--check`` 2029^^^^^^^^^^^ 2030 2031Enable 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. 2032 2033 2034 2035``-q``, ``--quiet`` 2036^^^^^^^^^^^^^^^^^^^ 2037 2038Only print fatal error messages. 2039 2040 2041 2042``-d``, ``--debug`` 2043^^^^^^^^^^^^^^^^^^^ 2044 2045Print debugging information to the terminal when running the install process. 2046The debugging information is also stored in 2047``~/.cache/virt-manager/virt-install.log`` even if this parameter is omitted. 2048 2049 2050 2051 2052EXAMPLES 2053======== 2054 2055The simplest invocation to interactively install a Fedora 29 KVM VM 2056with recommended defaults. virt-viewer(1) will be launched to 2057graphically interact with the VM install 2058 2059.. code-block:: 2060 2061 # sudo virt-install --install fedora29 2062 2063 2064 2065Similar, but use libosinfo's unattended install support, which will 2066perform the fedora29 install automatically without user intervention: 2067 2068.. code-block:: 2069 2070 # sudo virt-install --install fedora29 --unattended 2071 2072 2073 2074Install a Windows 10 VM, using 40GiB storage in the default location 2075and 4096MiB of ram, and ensure we are connecting to the system libvirtd 2076instance: 2077 2078.. code-block:: 2079 2080 # virt-install \ 2081 --connect qemu:///system \ 2082 --name my-win10-vm \ 2083 --memory 4096 \ 2084 --disk size=40 \ 2085 --os-variant win10 \ 2086 --cdrom /path/to/my/win10.iso 2087 2088 2089 2090Install a CentOS 7 KVM from a URL, with recommended device defaults and 2091default required storage, but specifically request VNC graphics instead 2092of the default SPICE, and request 8 virtual CPUs and 8192 MiB of memory: 2093 2094.. code-block:: 2095 2096 # virt-install \ 2097 --connect qemu:///system \ 2098 --memory 8192 \ 2099 --vcpus 8 \ 2100 --graphics vnc \ 2101 --os-variant centos7.0 \ 2102 --location http://mirror.centos.org/centos-7/7/os/x86_64/ 2103 2104 2105 2106Create a VM around an existing debian9 disk image: 2107 2108.. code-block:: 2109 2110 # virt-install \ 2111 --import \ 2112 --memory 512 \ 2113 --disk /home/user/VMs/my-debian9.img \ 2114 --os-variant debian9 2115 2116 2117 2118Start serial QEMU ARM VM, which requires specifying a manual kernel. 2119 2120.. code-block:: 2121 2122 # virt-install \ 2123 --name armtest \ 2124 --memory 1024 \ 2125 --arch armv7l --machine vexpress-a9 \ 2126 --disk /home/user/VMs/myarmdisk.img \ 2127 --boot kernel=/tmp/my-arm-kernel,initrd=/tmp/my-arm-initrd,dtb=/tmp/my-arm-dtb,kernel_args="console=ttyAMA0 rw root=/dev/mmcblk0p3" \ 2128 --graphics none 2129 2130 2131 2132Start an SEV launch security VM with 4GB RAM, 4GB+256MiB of hard_limit, with a 2133couple of virtio devices: 2134 2135Note: The IOMMU flag needs to be turned on with driver.iommu for virtio 2136devices. Usage of --memtune is currently required because of SEV limitations, 2137refer to libvirt docs for a detailed explanation. 2138 2139.. code-block:: 2140 2141 # virt-install \ 2142 --name foo \ 2143 --memory 4096 \ 2144 --boot uefi \ 2145 --machine q35 \ 2146 --memtune hard_limit=4563402 \ 2147 --disk size=15,target.bus=scsi \ 2148 --import \ 2149 --controller type=scsi,model=virtio-scsi,driver.iommu=on \ 2150 --controller type=virtio-serial,driver.iommu=on \ 2151 --network network=default,model=virtio,driver.iommu=on \ 2152 --rng /dev/random,driver.iommu=on \ 2153 --memballoon driver.iommu=on \ 2154 --launchSecurity sev 2155 2156 2157 2158BUGS 2159==== 2160 2161Please see https://virt-manager.org/bugs 2162 2163 2164 2165COPYRIGHT 2166========= 2167 2168Copyright (C) Red Hat, Inc, and various contributors. 2169This is free software. You may redistribute copies of it under the terms of 2170the GNU General Public License https://www.gnu.org/licenses/gpl.html. There 2171is NO WARRANTY, to the extent permitted by law. 2172 2173 2174 2175SEE ALSO 2176======== 2177 2178``virsh(1)``, ``virt-clone(1)``, ``virt-manager(1)``, the project website https://virt-manager.org 2179