virt-install.pod 54 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
=pod

=head1 NAME

virt-install - provision new virtual machines

=head1 SYNOPSIS

B<virt-install> [OPTION]...

=head1 DESCRIPTION

B<virt-install> is a command line tool for creating new KVM, Xen, or Linux
container guests using the C<libvirt> hypervisor management library.
See the EXAMPLES section at the end of this document to quickly get started.

B<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.

22 23 24
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 C<virt-install> will fetch the minimal files
25 26 27 28 29 30
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, C<virt-install> is capable of running
completely unattended, with the guest 'kickstarting' itself too. This allows
31 32 33 34 35
for easy automation of guest installs.

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=?
36

37
Most options are not required. Minimum requirements are --name, --memory,
38
guest storage (--disk or --filesystem), and an install option.
39 40


41
=head1 CONNECTING TO LIBVIRT
42

43
=over 4
44

45
=item B<--connect> URI
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75

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:

=over 4

=item qemu:///system

For creating KVM and QEMU guests to be run by the system libvirtd instance.
This is the default mode that virt-manager uses, and what most KVM users
want.

=item qemu:///session

For creating KVM and QEMU guests for libvirtd running as the regular user.

=item xen:///

For connecting to Xen.

=item lxc:///

For creating linux containers

=back

=back

76 77 78 79



=head1 GENERAL OPTIONS
80 81 82

General configuration parameters that apply to all types of guest installs.

83 84 85
=over 4

=item B<-n> NAME
86

87
=item B<--name> NAME
88 89 90 91 92 93 94

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 C<virsh(1)> tool
to shut it down ('virsh shutdown') & delete ('virsh undefine') it prior to
running C<virt-install>.

95
=item B<--memory> OPTIONS
96

97 98 99 100 101 102 103
Memory to allocate for the guest, in MiB. This deprecates the -r/--ram option.
Sub options are available, like 'maxmemory', 'hugepages', 'hotplugmemorymax'
and 'hotplugmemoryslots'.  The memory parameter is mapped to <currentMemory> element,
the 'maxmemory' sub-option is mapped to <memory> element and 'hotplugmemorymax'
and 'hotplugmemoryslots' are mapped to <maxMemory> element.

To configure memory modules which can be hotunplugged see B<--memdev> description.
104

105
Use --memory=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsMemoryAllocation>
106

107
=item B<--memorybacking> OPTIONS
108 109 110

This option will influence how virtual memory pages are backed by host pages.

111
Use --memorybacking=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsMemoryBacking>
112

113
=item B<--arch> ARCH
114 115 116 117

Request a non-native CPU architecture for the guest virtual machine.
If omitted, the host CPU architecture will be used in the guest.

118
=item B<--machine> MACHINE
119 120 121 122 123

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.

124
=item B<--metadata> OPT=VAL,[...]
125

126
Specify metadata values for the guest. Possible options include name, uuid, title, and description. This option deprecates -u/--uuid and --description.
127

128
Use --metadata=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsMetadata>
129

130 131 132 133
=item B<--events> OPT=VAL,[...]

Specify events values for the guest. Possible options include on_poweroff, on_reboot, and on_crash.

134
Use --events=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsEvents>
135 136 137 138 139

=item B<--resource> OPT=VAL,[...]

Specify resource partitioning for the guest.

140
Use --resource=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#resPartition>
141

142 143 144 145
=item B<--sysinfo> OPT=VAL,[...]

Configure sysinfo/SMBIOS values exposed to the guest OS. '--sysinfo host' can be used to expose the host's SMBIOS info to the VM, otherwise values can be manually specified.

146
Use --sysinfo=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsSysinfo>
147 148 149 150 151 152 153 154 155 156 157 158 159

=item B<--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: L<https://libvirt.org/drvqemu.html#qemucommand>

160
=item B<--vcpus> OPTIONS
161 162 163 164 165 166 167 168 169

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.

170
'cpuset' sets which physical cpus the guest can use. C<CPUSET> is a comma separated list of numbers, which can also be specified in ranges or cpus to exclude. Example:
171 172 173 174 175 176 177

    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.

178
Use --vcpus=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsCPUAllocation>
179

180
=item B<--numatune> OPTIONS
181 182 183 184

Tune NUMA policy for the domain process. Example invocations

    --numatune 1,2,3,4-7
185
    --numatune 1-3,5,mode=preferred
186 187

Specifies the numa nodes to allocate memory from. This has the same syntax
188
as C<--vcpus cpuset=> option. mode can be one of 'interleave', 'preferred', or
189 190 191
'strict' (the default). See 'man 8 numactl' for information about each
mode.

192
Use --numatune=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsNUMATuning>
193

194
=item B<--memtune> OPTIONS
195 196 197 198 199 200

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

201
Use --memtune=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsMemoryTuning>
202

203
=item B<--blkiotune> OPTIONS
204 205 206 207 208 209

Tune blkio policy for the domain process. Example invocations

    --blkiotune 100
    --blkiotune weight=100,device_path=/dev/sdc,device_weight=200

210
Use --blkiotune=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsBlockTuning>
211

212
=item B<--cpu> MODEL[,+feature][,-feature][,match=MATCH][,vendor=VENDOR],...
213 214

Configure the CPU model and CPU features exposed to the guest. The only
215
required value is MODEL, which is a valid CPU model as known to libvirt.
216

217
Libvirt's feature policy values force, require, optional, disable, or forbid,
218 219 220 221 222
or with the shorthand '+feature' and '-feature', which equal 'force=feature'
and 'disable=feature' respectively

Some examples:

223
=over 4
224 225 226 227 228 229 230 231 232 233 234

=item B<--cpu core2duo,+x2apic,disable=vmx>

Expose the core2duo CPU model, force enable x2apic, but do not expose vmx

=item B<--cpu host>

Expose the host CPUs configuration to the guest. This enables the guest to
take advantage of many of the host CPUs features (better performance), but
may cause issues if migrating the guest to a host without an identical CPU.

235 236 237 238
=item B<--cpu host-model-only>

Expose the nearest host CPU model configuration to the guest.
It is the best CPU which can be used for a guest on any of the hosts.
239

240 241 242 243 244 245 246 247 248 249 250
=item B<--cpu cell0.memory=1234,cell0.cpus=0-3,cell1.memory=5678,cell1.cpus=4-7>

Example of specifying two NUMA cells. This will generate XML like:

  <cpu>
    <numa>
      <cell cpus="0-3" memory="1234"/>
      <cell cpus="4-7" memory="5678"/>
    </numa>
  </cpu>

251 252 253 254
=item B<--cpu host-passthrough,cache.mode=passthrough>

Example of passing through the host cpu's cache information.

255
=back
256

257
Use --cpu=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsCPU>
258

259 260 261 262 263 264 265 266
=item B<--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 vpcupin0.vcpu=0,vpcupin0.cpuset=0-3,vpcupin1.vcpu=1,vpcupin1.cpuset=4-7

267
Use --cputune=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsCPUTuning>
268

269
=item B<--security> type=TYPE[,label=LABEL][,relabel=yes|no]
270 271 272 273 274 275 276 277 278

Configure domain security driver settings. Type can be either 'static' or
'dynamic'. 'static' configuration requires a security LABEL. Specifying
LABEL without TYPE implies static configuration.

To have libvirt automatically apply your static label, you must specify
relabel=yes. Otherwise disk images must be manually labeled by the admin,
including images that virt-install is asked to create.

279
Use --security=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#seclabel>
280

281
=item B<--features> FEAT=on|off,...
282 283 284 285

Set elements in the guests <features> XML on or off. Examples include acpi,
apic, eoi, privnet, and hyperv features. Some examples:

286
=over 4
287 288 289 290 291 292 293 294 295

=item B<--features eoi=on>

Enable APIC PV EOI

=item B<--features hyperv_vapic=on,hyperv_spinlocks=off>

Enable hypver VAPIC, but disable spinlocks

296 297 298 299 300 301 302 303
=item B<--features kvm_hidden=on>

Allow the KVM hypervisor signature to be hidden from the guest

=item B<--features pvspinlock=on>

Notify the guest that the host supports paravirtual spinlocks for example by exposing the pvticketlocks mechanism.

304 305 306 307 308
=item B<--features gic_version=2>

This is relevant only for ARM architectures. Possible values are "host" or
version number.

309 310 311 312 313 314
=item B<--features smm=on>

This enables System Management Mode of hypervisor. Some UEFI firmwares may
require this feature to be present. (QEMU supports SMM only with q35 machine
type.)

315 316
=back

317
Use --features=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsFeatures>
318

319
=item B<--clock> offset=OFFSET,TIMER_OPT=VAL,...
320 321 322

Configure the guest's <clock> XML. Some supported options:

323
=over 4
324 325 326 327 328 329 330 331 332 333 334 335 336 337

=item B<--clock offset=OFFSET>

Set the clock offset, ex. 'utc' or 'localtime'

=item B<--clock TIMER_present=no>

Disable a boolean timer. TIMER here might be hpet, kvmclock, etc.

=item B<--clock TIMER_tickpolicy=VAL>

Set a timer's tickpolicy value. TIMER here might be rtc, pit, etc. VAL
might be catchup, delay, etc. Refer to the libvirt docs for all values.

338 339
=back

340
Use --clock=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsTime>
341 342


343
=item B<--pm> OPTIONS
344

345
Configure guest power management features. Example suboptions include suspend_to_mem=on|off and suspend_to_disk=on|off
346

347
Use --pm=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsPowerManagement>
348 349 350 351



=back
352

353
=head1 INSTALLATION OPTIONS
354

355
=over 4
356

357 358
=item B<-c> OPTIONS

359
=item B<--cdrom> OPTIONS
360

361
File or device used as a virtual CD-ROM device.
362 363 364 365 366 367
It can be path to an ISO image, or to a CDROM device. It can also be a URL
from which to fetch/access a minimal boot ISO image. The URLs take the same
format as described for the C<--location> argument. If a cdrom has been
specified via the C<--disk> option, and neither C<--cdrom> nor any other
install option is specified, the C<--disk> cdrom is used as the install media.

368 369 370
=item B<-l> LOCATION

=item B<--location> OPTIONS
371 372 373 374 375 376 377 378 379 380

Distribution tree installation source. virt-install can recognize
certain distribution trees and fetches a bootable kernel/initrd pair to
launch the install.

With libvirt 0.9.4 or later, network URL installs work for remote connections.
virt-install will download kernel/initrd to the local machine, and then
upload the media to the remote host. This option requires the URL to
be accessible by both the local and remote host.

381 382 383 384 385 386
--location allows things like --extra-args for kernel arguments, and using --initrd-inject. If you want to use those options with CDROM media, you have a few options:

* Run virt-install as root and do --location ISO

* Mount the ISO at a local directory, and do --location DIRECTORY

387
* Mount the ISO at a local directory, export that directory over local http, and do --location https://localhost/DIRECTORY
388

389 390 391 392
The C<LOCATION> can take one of the following forms:

=over 4

393
=item https://host/path
394 395

An HTTP server location containing an installable distribution image.
396

397 398 399
=item ftp://host/path

An FTP server location containing an installable distribution image.
400

401
=item DIRECTORY
402

403
Path to a local directory containing an installable distribution image. Note that the directory will not be accessible by the guest after initial boot, so the OS installer will need another way to access the rest of the install media.
404

405
=item ISO
406

407
Mount the ISO and probe the directory. This requires running virt-install as root, and has the same VM access caveat as DIRECTORY.
408 409 410 411 412 413 414 415 416

=back

Some distro specific url samples:

=over 4

=item Fedora/Red Hat Based

417
https://download.fedoraproject.org/pub/fedora/linux/releases/25/Server/x86_64/os
418

419
=item Debian
420

421
https://ftp.us.debian.org/debian/dists/stable/main/installer-amd64/
422

423 424
=item Ubuntu

425
https://us.archive.ubuntu.com/ubuntu/dists/wily/main/installer-amd64/
426

427 428
=item Suse

429
https://download.opensuse.org/pub/opensuse/distribution/leap/42.3/repo/oss/
430 431 432 433 434 435 436 437 438 439 440

=item Mandriva

ftp://ftp.uwsg.indiana.edu/linux/mandrake/official/2009.0/i586/

=item Mageia

ftp://distrib-coffee.ipsl.jussieu.fr/pub/linux/Mageia/distrib/1

=back

441
=item B<--pxe>
442 443 444 445

Use the PXE boot protocol to load the initial ramdisk and kernel for starting
the guest installation process.

446
=item B<--import>
447 448 449 450 451

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
C<--disk> or C<--filesystem>.

452
=item B<--livecd>
453 454 455

Specify that the installation media is a live CD and thus the guest
needs to be configured to boot off the CDROM device permanently. It
456
may be desirable to also use the C<--disk none> flag in combination.
457

458 459 460
=item B<-x> EXTRA

=item B<--extra-args> OPTIONS
461 462 463 464

Additional kernel command line arguments to pass to the installer when
performing a guest install from C<--location>. One common usage is specifying
an anaconda kickstart file for automated installs, such as
465
--extra-args "ks=https://myserver/my.ks"
466

467
=item B<--initrd-inject> PATH
468 469 470 471 472 473 474

Add PATH to the root of the initrd fetched with C<--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"

475
=item B<--os-variant> OS_VARIANT
476

477
Optimize the guest configuration for a specific operating system (ex.
478
'fedora18', 'rhel7', 'winxp'). While not required, specifying this
479 480
options is HIGHLY RECOMMENDED, as it can greatly increase performance
by specifying virtio among other guest tweaks.
481 482 483

By default, virt-install will attempt to auto detect this value from
the install media (currently only supported for URL installs). Autodetection
484 485
can be disabled with the special value 'none'. Autodetection can be
forced with the special value 'auto'.
486

487 488
Use the command "osinfo-query os" to get the list of the accepted OS
variants.
489

490
=item B<--boot> BOOTOPTS
491 492 493 494 495 496 497 498 499 500 501 502 503

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:

504
=over 4
505 506 507 508 509 510 511 512 513 514 515

=item B<--boot cdrom,fd,hd,network,menu=on>

Set the boot device priority as first cdrom, first floppy, first harddisk,
network PXE boot. Additionally enable BIOS boot menu prompt.

=item B<--boot kernel=KERNEL,initrd=INITRD,kernel_args="console=/dev/ttyS0">

Have guest permanently boot off a local kernel/initrd pair, with the
specified kernel options.

516 517 518 519 520 521
=item B<--boot kernel=KERNEL,initrd=INITRD,dtb=DTB>

Have guest permanently boot off a local kernel/initrd pair with an
external device tree binary. DTB can be required for some non-x86
configurations like ARM or PPC

522 523
=item B<--boot loader=BIOSPATH>

524
Use BIOSPATH as the virtual machine BIOS.
525

526 527 528 529 530 531 532 533 534 535 536
=item B<--boot menu=on,useserial=on>

Enable the bios boot menu, and enable sending bios text output over
serial console.

=item B<--boot init=INITPATH>

Path to a binary that the container guest will init. If a root C<--filesystem>
has been specified, virt-install will default to /sbin/init, otherwise
will default to /bin/sh.

537 538 539 540 541 542 543
=item B<--boot uefi>

Configure the VM to boot from UEFI. In order for virt-install to know the
correct UEFI parameters, libvirt needs to be advertising known UEFI binaries
via domcapabilities XML, so this will likely only work if using properly
configured distro packages.

544
=item B<--boot loader=/.../OVMF_CODE.fd,loader_ro=yes,loader_type=pflash,nvram_template=/.../OVMF_VARS.fd,loader_secure=no>
545 546 547 548 549

Specify that the virtual machine use the custom OVMF binary as boot firmware,
mapped as a virtual flash chip. In addition, request that libvirt instantiate
the VM-specific UEFI varstore from the custom "/.../OVMF_VARS.fd" varstore
template. This is the recommended UEFI setup, and should be used if
550 551
--boot uefi doesn't know about your UEFI binaries. If your UEFI firmware
supports Secure boot feature you can enable it via loader_secure.
552

553 554
=back

555
Use --boot=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsOS>
556

557
=item B<--idmap> OPTIONS
558 559 560 561 562 563 564 565 566 567 568

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

569
Use --idmap=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsOSContainer>
570

571 572 573 574 575 576
=back





577
=head1 STORAGE OPTIONS
578

579
=over 4
580

581
=item B<--disk> OPTIONS
582 583 584 585 586 587

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,...

588 589 590 591 592
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:
593

594
    --disk /some/storage/path[,opt1=val1]...
595 596 597 598 599 600 601 602

or explicitly specify one of the following arguments:

=over 4

=item B<path>

A path to some storage media to use, existing or not. Existing media can be
603
a file or block device.
604 605

Specifying a non-existent path implies attempting to create the new storage,
606 607
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.
608

609
If the hypervisor supports it, B<path> can also be a network URL, like
610
https://example.com/some-disk.img . For network paths, they hypervisor will
611 612
directly access the storage, nothing is downloaded locally.

613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630
=item B<pool>

An existing libvirt storage pool name to create new storage on. Requires
specifying a 'size' value.

=item B<vol>

An existing libvirt storage volume to use. This is specified as
'poolname/volname'.

=back

Other available options:

=over 4

=item B<device>

631
Disk device type. Value can be 'cdrom', 'disk', 'lun' or 'floppy'. Default is
632 633 634
'disk'. If a 'cdrom' is specified, and no install method is chosen, the
cdrom is used as the install media.

635 636 637 638
=item B<boot_order>

Guest installation with multiple disks will need this parameter to boot correctly after being installed. A boot_order parameter will take values 1,2,3,... Devices with lower value has higher priority.

639 640 641 642 643 644
=item B<bus>

Disk bus type. Value can be 'ide', 'sata', 'scsi', 'usb', 'virtio' or 'xen'.
The default is hypervisor dependent since not all hypervisors support all
bus types.

645 646 647 648
=item B<removable>

Sets the removable flag (/sys/block/$dev/removable on Linux). Only
used with QEMU and bus=usb. Value can be 'on' or 'off'.
649

650 651 652 653 654 655 656
=item B<readonly>

Set drive as readonly (takes 'on' or 'off')

=item B<shareable>

Set drive as shareable (takes 'on' or 'off')
657 658 659

=item B<size>

660
size (in GiB) to use if creating new storage
661 662 663

=item B<sparse>

664 665
whether to skip fully allocating newly created storage. Value is 'yes' or
'no'. Default is 'yes' (do not fully allocate) unless it isn't
666 667
supported by the underlying storage type.

668
The initial time taken to fully-allocate the guest virtual disk (sparse=no)
669 670 671 672
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.

673 674 675 676
=item B<backing_store>

Path to a disk to use as the backing store for the newly created image.

677 678 679 680
=item B<backing_format>

Disk image format of B<backing_store>

681 682 683
=item B<cache>

The cache mode to be used. The host pagecache provides cache memory.
684 685
The cache value can be 'none', 'writethrough', 'directsync', 'unsafe'
or 'writeback'.
686
'writethrough' provides read caching. 'writeback' provides
687 688 689 690 691 692 693 694 695 696
read and write caching. 'directsync' bypasses the host page
cache. 'unsafe' may cache all content and ignore flush requests from
the guest.

=item B<discard>

Whether discard (also known as "trim" or "unmap") requests are ignored
or passed to the filesystem. The value can be either "unmap" (allow
the discard request to be passed) or "ignore" (ignore the discard
request). Since 1.0.6 (QEMU and KVM only)
697 698 699

=item B<format>

700
Disk image format. For file volumes, this can be 'raw', 'qcow2', 'vmdk', etc. See format types in L<https://libvirt.org/storage.html> for possible values. This is often mapped to the B<driver_type> value as well.
701

702 703 704
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.
705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730

=item B<driver_name>

Driver name the hypervisor should use when accessing the specified
storage. Typically does not need to be set by the user.

=item B<driver_type>

Driver format/type the hypervisor should use when accessing the specified
storage. Typically does not need to be set by the user.

=item B<io>

Disk IO backend. Can be either "threads" or "native".

=item B<error_policy>

How guest should react if a write error is encountered. Can be one of
"stop", "ignore", or "enospace"

=item B<serial>

Serial number of the emulated disk device. This is used in linux guests
to set /dev/disk/by-id symlinks. An example serial number might be:
WD-WMAP9A966149

731 732 733
=item B<startup_policy>

It defines what to do with the disk if the source file is not accessible.  See
734
possible values in L<https://www.libvirt.org/formatdomain.html#elementsDisks>, "startupPolicy" attribute of the <disk> element
735

736 737 738
=item B<snapshot_policy>

Defines default behavior of the disk during disk snapshots.  See possible
739
values in L<https://www.libvirt.org/formatdomain.html#elementsDisks>,
740 741
"snapshot" attribute of the <disk> element.

742 743
=back

744
See the examples section for some uses. This option deprecates -f/--file,
745
-s/--file-size, --nonsparse, and --nodisks.
746

747
Use --disk=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsDisks>
748

749
=item B<--filesystem>
750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784

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.

The following explicit options can be specified:

=over 4

=item B<type>

The type or the source directory. Valid values are 'mount' (the default) or
'template' for OpenVZ templates.

=item B<mode>

The access mode for the source directory from the guest OS. Only used with
QEMU and type=mount. Valid modes are 'passthrough' (the default), 'mapped',
or 'squash'. See libvirt domain XML documentation for more info.

=item B<source>

The directory on the host to share.

=item B<target>

The mount location to use in the guest.

=back

785
Use --filesystem=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsFilesystems>
786

787 788 789 790 791 792
=back





793
=head1 NETWORKING OPTIONS
794

795
=over 4
796

797 798 799
=item B<-w> OPTIONS

=item B<--network> OPTIONS
800 801

Connect the guest to the host network. The value for C<NETWORK> can take
802
one of 4 formats:
803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821

=over 4

=item bridge=BRIDGE

Connect to a bridge device in the host called C<BRIDGE>. Use this option if
the host has static networking config & the guest requires full outbound
and inbound connectivity  to/from the LAN. Also use this if live migration
will be used with this guest.

=item network=NAME

Connect to a virtual network in the host called C<NAME>. Virtual networks
can be listed, created, deleted using the C<virsh> command line tool. In
an unmodified install of C<libvirt> there is usually a virtual network
with a name of C<default>. Use a virtual network if the host has dynamic
networking (eg NetworkManager), or using wireless. The guest will be
NATed to the LAN by whichever connection is active.

822 823 824 825
=item type=direct,source=IFACE[,source_mode=MODE]

Direct connect to host interface IFACE using macvtap.

826 827 828 829 830
=item user

Connect to the LAN using SLIRP. Only use this if running a QEMU guest as
an unprivileged user. This provides a very limited form of NAT.

831 832 833 834
=item none

Tell virt-install not to add any default network interface.

835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859
=back

If this option is omitted a single NIC will be created in the guest. If
there is a bridge device in the host with a physical interface enslaved,
that will be used for connectivity. Failing that, the virtual network
called C<default> will be used. This option can be specified multiple
times to setup more than one NIC.

Other available options are:

=over 4

=item B<model>

Network device model as seen by the guest. Value can be any nic model supported
by the hypervisor, e.g.: 'e1000', 'rtl8139', 'virtio', ...

=item B<mac>

Fixed MAC address for the guest; If this parameter is omitted, or the value
C<RANDOM> is specified a suitable address will be randomly generated. For
Xen virtual machines it is required that the first 3 pairs in the MAC address
be the sequence '00:16:3e', while for QEMU or KVM virtual machines it must
be '52:54:00'.

860
=item B<filterref>
861

862 863 864
Controlling firewall and network filtering in libvirt. Value can be any nwfilter
defined by the C<virsh> 'nwfilter' subcommands. Available filters can be listed
by running 'virsh nwfilter-list', e.g.: 'clean-traffic', 'no-mac-spoofing', ...
865

866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950
=item B<virtualport_type>

The type of virtual port profile, one the following values

=over 4

=item C<802.Qbg>

The following additional parameters are accepted

=over 4

=item B<virtualport_managerid>


The VSI Manager ID identifies the database containing the VSI type
and instance definitions. This is an integer value and the value
0 is reserved.

=item B<virtualport_typeid>

The VSI Type ID identifies a VSI type characterizing the network
access. VSI types are typically managed by network administrator.
This is an integer value.

=item B<virtualport_typeidversion>

The VSI Type Version allows multiple versions of a VSI Type. This
is an integer value.

=item B<virtualport_instanceid>

The VSI Instance ID Identifier is generated when a VSI instance
(i.e. a virtual interface of a virtual machine) is created. This
is a globally unique identifier.

=back

=item C<802.Qbh>

The following additional parameters are accepted

=over 4

=item B<virtualport_profileid>

The profile ID contains the name of the port profile that is to
be applied to this interface. This name is resolved by the port
profile database into the network parameters from the port profile,
and those network parameters will be applied to this interface.

=back

=item C<openvswitch>

The following additional parameters are accepted

=over 4

=item B<virtualport_profileid>

The OpenVSwitch port profile for the interface

=item B<virtualport_interfaceid>

A UUID to uniquely identify the interface. If omitted one will
be generated automatically

=back

=item C<midonet>

The following additional parameters are accepted

=over 4

=item B<virtualport_interfaceid>

A UUID identifying the port in the network to which the interface
will be bound

=back

=back

951
=back
952

953
Use --network=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsNICS>
954

955
This option deprecates -m/--mac, -b/--bridge, and --nonetworks
956 957 958 959 960 961 962

=back





963
=head1 GRAPHICS OPTIONS
964

965 966 967
If no graphics option is specified, C<virt-install> will try to select
the appropriate graphics if the DISPLAY environment variable is set,
otherwise '--graphics none' is used.
968

969
=over 4
970

971
=item B<--graphics> TYPE,opt1=arg1,opt2=arg2,...
972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014

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

The supported options are:

=over 4

=item B<type>

The display type. This is one of:

vnc

Setup a virtual console in the guest and export it as a VNC server in
the host. Unless the C<port> parameter is also provided, the VNC
server will run on the first free port number at 5900 or above. The
actual VNC display allocated can be obtained using the C<vncdisplay>
command to C<virsh> (or L<virt-viewer(1)> can be used which handles this
detail for the use).

spice

Export the guest's console using the Spice protocol. Spice allows advanced
features like audio and USB device streaming, as well as improved graphical
performance.

Using spice graphic type will work as if those arguments were given:

    --video qxl --channel spicevmc

none

1015 1016 1017 1018
No graphical console will be allocated for the guest. Guests will likely
need to have a text console configured on the first
serial port in the guest (this can be done via the --extra-args option). The
command 'virsh console NAME' can be used to connect to the serial device.
1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033

=item B<port>

Request a permanent, statically assigned port number for the guest
console. This is used by 'vnc' and 'spice'

=item B<tlsport>

Specify the spice tlsport.

=item B<listen>

Address to listen on for VNC/Spice connections. Default is typically 127.0.0.1
(localhost only), but some hypervisors allow changing this globally (for
example, the qemu driver default can be changed in /etc/libvirt/qemu.conf).
1034 1035 1036 1037 1038 1039 1040 1041 1042 1043
Use 0.0.0.0 to allow access from other machines.

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'
1044 1045 1046

=item B<keymap>

1047
Request that the virtual console be configured to run with a specific
1048 1049 1050 1051
keyboard layout. If the special value 'local' is specified, virt-install
will attempt to configure to use the same keymap as the local system. A value
of 'none' specifically defers to the hypervisor. Default behavior is
hypervisor specific, but typically is the same as 'local'. This is used
1052
by 'vnc' and 'spice'.
1053 1054 1055

=item B<password>

1056
Request a console password, required at connection time. Beware, this info may
1057 1058 1059
end up in virt-install log files, so don't use an important password. This
is used by 'vnc' and 'spice'

1060 1061 1062 1063 1064
=item B<gl>

Whether to use OpenGl accelerated rendering. Value is 'yes' or 'no'. This is
used by 'spice'.

1065 1066 1067 1068
=item B<rendernode>

DRM render node path to use. This is used when 'gl' is enabled.

1069 1070
=back

1071
Use --graphics=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsGraphics>
1072

1073
This deprecates the following options: --vnc, --vncport, --vnclisten, -k/--keymap, --sdl, --nographics
1074

1075
=item B<--noautoconsole>
1076 1077

Don't automatically try to connect to the guest console. The default behaviour
1078
is to launch L<virt-viewer(1)> to display the graphical console, or to run the
1079 1080 1081 1082 1083 1084 1085 1086
C<virsh> C<console> command to display the text console. Use of this parameter
will disable this behaviour.

=back




1087
=head1 VIRTUALIZATION OPTIONS
1088 1089 1090

Options to override the default virtualization type choices.

1091 1092 1093
=over 4

=item B<-v>
1094

1095
=item B<--hvm>
1096 1097 1098 1099 1100 1101

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.

1102 1103 1104
=item B<-p>

=item B<--paravirt>
1105 1106 1107 1108 1109

This guest should be a paravirtualized guest. If the host supports both
para & full virtualization, and neither this parameter nor the C<--hvm>
are specified, this will be assumed.

1110
=item B<--container>
1111 1112 1113 1114 1115 1116

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).

1117
=item B<--virt-type>
1118

1119
The hypervisor to install on. Example choices are kvm, qemu, or xen.
1120 1121
Available options are listed via 'virsh capabilities' in the <domain> tags.

1122
This deprecates the --accelerate option, which is now the default behavior. To install a plain QEMU guest, use '--virt-type qemu'
1123 1124 1125 1126 1127 1128 1129

=back





1130
=head1 DEVICE OPTIONS
1131

1132 1133
All devices have a set of B<address.*> options for configuring the
particulars of the device's address on its parent controller or bus.
1134
See C<https://libvirt.org/formatdomain.html#elementsAddress> for details.
1135

1136
=over 4
1137

1138
=item B<--controller> OPTIONS
1139 1140 1141 1142

Attach a controller device to the guest. TYPE is one of:
B<ide>, B<fdc>, B<scsi>, B<sata>, B<virtio-serial>, or B<usb>.

1143 1144 1145
Controller also supports the special values B<usb2> and B<usb3> to
specify which version of the USB controller should be used (version 2
or 3).
1146 1147 1148 1149 1150 1151 1152 1153 1154

=over 4

=item B<model>

Controller model.  These may vary according to the hypervisor and its
version.  Most commonly used models are e.g. B<auto>, B<virtio-scsi>
for the B<scsi> controller, B<ehci> or B<none> for the B<usb>
controller.  For full list and further details on controllers/models,
1155
see C<https://libvirt.org/formatdomain.html#elementsControllers>.
1156 1157 1158

=item B<address>

1159 1160
Shorthand for setting a manual PCI address from an lscpi style string.
The preferred method for setting this is using the address.* parameters.
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176

=item B<index>

A decimal integer describing in which order the bus controller is
encountered, and to reference the controller bus.

=item B<master>

Applicable to USB companion controllers, to define the master bus startport.

=back

Examples:

=over 4

1177
=item B<--controller usb,model=ich9-ehci1,address=0:0:4.0,index=0>
1178

1179
Adds a ICH9 EHCI1 USB controller on PCI address 0:0:4.0
1180 1181 1182 1183 1184 1185

=item B<--controller usb,model=ich9-uhci2,address=0:0:4.7,index=0,master=2>

Adds a ICH9 UHCI2 USB companion controller for the previous master
controller, ports start from port number 2.

1186 1187 1188
The parameter multifunction='on' will be added automatically to the
proper device (if needed).  This applies to all PCI devices.

1189 1190
=back

1191
Use --controller=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsControllers>
1192

1193 1194 1195 1196 1197

=item B<--input> OPTIONS

Attach an input device to the guest. Example input device types are mouse, tablet, or keyboard.

1198
Use --input=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsInput>
1199 1200 1201 1202 1203


=item B<--hostdev> OPTIONS

=item B<--host-device> OPTIONS
1204 1205 1206

Attach a physical host device to the guest. Some example values for HOSTDEV:

1207
=over 4
1208

1209
=item B<--hostdev pci_0000_00_1b_0>
1210 1211 1212

A node device name via libvirt, as shown by 'virsh nodedev-list'

1213
=item B<--hostdev 001.003>
1214 1215 1216

USB by bus, device (via lsusb).

1217
=item B<--hostdev 0x1234:0x5678>
1218 1219 1220

USB by vendor, product (via lsusb).

1221
=item B<--hostdev 1f.01.02>
1222 1223 1224

PCI device (via lspci).

1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236
=item B<--hostdev wlan0,type=net>

Network device (in LXC container).

=item B<--hostdev /dev/net/tun,type=misc>

Character device (in LXC container).

=item B<--hostdev /dev/sdf,type=storage>

Block device (in LXC container).

1237 1238
=back

1239
Use --hostdev=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsHostDev>
1240

1241
=item B<--sound> MODEL
1242 1243

Attach a virtual audio device to the guest. MODEL specifies the emulated
1244
sound card model. Possible values are ich6, ich9, ac97, es1370, sb16, pcspk,
1245 1246 1247
or default. 'default' will try to pick the best model that the specified
OS supports.

1248
This deprecates the old --soundhw option.
1249

1250
Use --sound=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsSound>
1251

1252
=item B<--watchdog> MODEL[,action=ACTION]
1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294

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

=over 4

=item B<reset>

Forcefully reset the guest (the default)

=item B<poweroff>

Forcefully power off the guest

=item B<pause>

Pause the guest

=item B<none>

Do nothing

=item B<shutdown>

Gracefully shutdown the guest (not recommended, since a hung guest probably
won't respond to a graceful shutdown)

=back

MODEL is the emulated device model: either i6300esb (the default) or ib700.
Some examples:

Use the recommended settings:

--watchdog default

Use the i6300esb with the 'poweroff' action

--watchdog i6300esb,action=poweroff

1295
Use --watchdog=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsWatchdog>
1296

1297
=item B<--parallel> OPTIONS
1298

1299
=item B<--serial> OPTIONS
1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373

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:

=over 4

=item B<--serial pty>

Pseudo TTY. The allocated pty will be listed in the running guests XML
description.

=item B<--serial dev,path=HOSTPATH>

Host device. For serial devices, this could be /dev/ttyS0. For parallel
devices, this could be /dev/parport0.

=item B<--serial file,path=FILENAME>

Write output to FILENAME.

=item B<--serial pipe,path=PIPEPATH>

Named pipe (see pipe(7))

=item B<--serial tcp,host=HOST:PORT,mode=MODE,protocol=PROTOCOL>

TCP net console. MODE is either 'bind' (wait for connections on HOST:PORT)
or 'connect' (send output to HOST:PORT), default is 'bind'. HOST defaults
to '127.0.0.1', but PORT is required. PROTOCOL can be either 'raw' or 'telnet'
(default 'raw'). If 'telnet', the port acts like a telnet server or client.
Some examples:

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,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,mode=bind,protocol=telnet

=item B<--serial udp,host=CONNECT_HOST:PORT,bind_host=BIND_HOST:BIND_PORT>

UDP net console. HOST:PORT is the destination to send output to (default
HOST is '127.0.0.1', PORT is required). BIND_HOST:BIND_PORT is the optional
local address to bind to (default BIND_HOST is 127.0.0.1, but is only set if
BIND_PORT is specified). Some examples:

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

=item B<--serial unix,path=UNIXPATH,mode=MODE>

Unix socket, see unix(7). MODE has similar behavior and defaults as
--serial tcp,mode=MODE

=back

1374
Use --serial=? or --parallel=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsCharSerial> and L<https://libvirt.org/formatdomain.html#elementsCharParallel>
1375

1376
=item B<--channel>
1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409

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:

=over 4

=item B<--channel SOURCE,target_type=guestfwd,target_address=HOST:PORT>

Communication channel using QEMU usermode networking stack. The guest can
connect to the channel using the specified HOST:PORT combination.

=item B<--channel SOURCE,target_type=virtio[,name=NAME]>

Communication channel using virtio serial (requires 2.6.34 or later host and
guest). Each instance of a virtio --channel line is exposed in the
guest as /dev/vport0p1, /dev/vport0p2, etc. NAME is optional metadata, and
can be any string, such as org.linux-kvm.virtioport1.
If specified, this will be exposed in the guest at
/sys/class/virtio-ports/vport0p1/NAME

=item B<--channel spicevmc,target_type=virtio[,name=NAME]>

Communication channel for QEMU spice agent, using virtio serial
(requires 2.6.34 or later host and guest). NAME is optional metadata,
and can be any string, such as the default com.redhat.spice.0 that
specifies how the guest will see the channel.

=back

1410
Use --channel=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsCharChannel>
1411

1412
=item B<--console>
1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426

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:

=over 4

=item B<--console pty,target_type=virtio>

Connect a virtio console to the guest, redirected to a PTY on the host.
For supported guests, this exposes /dev/hvc0 in the guest. See
1427
https://fedoraproject.org/wiki/Features/VirtioSerial for more info. virtio
1428 1429 1430 1431
console requires libvirt 0.8.3 or later.

=back

1432
Use --console=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsCharConsole>
1433

1434
=item B<--video> OPTIONS
1435 1436 1437

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
1438
cirrus, vga, qxl, virtio, or vmvga (vmware).
1439

1440
Use --video=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsVideo>
1441

1442
=item B<--smartcard> MODE[,OPTIONS]
1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468

Configure a virtual smartcard device.

Mode is one of B<host>, B<host-certificates>, or B<passthrough>. Additional
options are:

=over 4

=item B<type>

Character device type to connect to on the host. This is only applicable
for B<passthrough> mode.

=back

An example invocation:

=over 4

=item B<--smartcard passthrough,type=spicevmc>

Use the smartcard channel of a SPICE graphics device to pass smartcard info
to the guest

=back

1469
Use --smartcard=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsSmartcard>
1470

1471
=item B<--redirdev> BUS[,OPTIONS]
1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501

Add a redirected device.

=over 4

=item B<type>

The redirection type, currently supported is B<tcp> or B<spicevmc>.

=item B<server>

The TCP server connection details, of the form 'server:port'.

=back

Examples of invocation:

=over 4

=item B<--redirdev usb,type=tcp,server=localhost:4000>

Add a USB redirected device provided by the TCP server on 'localhost'
port 4000.

=item B<--redirdev usb,type=spicevmc>

Add a USB device redirected via a dedicated Spice channel.

=back

1502
Use --redirdev=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsRedir>
1503

1504
=item B<--memballoon> MODEL
1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520

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 the recommended settings:

--memballoon virtio

Do not use memballoon device:

--memballoon none

1521
Use --memballoon=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsMemBalloon>
1522

1523
=item B<--tpm> TYPE[,OPTIONS]
1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551

Configure a virtual TPM device.

Type must be B<passthrough>. Additional options are:

=over 4

=item B<model>

The device model to present to the guest operating system. Model
must be B<tpm-tis>.

=back

An example invocation:

=over 4

=item B<--tpm passthrough,model=tpm-tis>

Make the host's TPM accessible to a single guest.

=item B<--tpm /dev/tpm>

Convenience option for passing through the hosts TPM.

=back

1552
Use --tpm=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsTpm>
1553

1554
=item B<--rng> TYPE[,OPTIONS]
1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616

Configure a virtual RNG device.

Type can be B<random> or B<egd>.

If the specified type is B<random> then these values must
be specified:

=over 4

=item B<backend_device>

The device to use as a source of entropy.

=back

Whereas, when the type is B<egd>, these values must be provided:

=over 4

=item B<backend_host>

Specify the host of the Entropy Gathering Daemon to connect to.

=item B<backend_service>

Specify the port of the Entropy Gathering Daemon to connect to.

=item B<backend_type>

Specify the type of the connection: B<tcp> or B<udp>.

=item B<backend_mode>

Specify the mode of the connection.  It is either 'bind' (wait for
connections on HOST:PORT) or 'connect' (send output to HOST:PORT).

=item B<backend_connect_host>

Specify the remote host to connect to when the specified backend_type is B<udp>
and backend_mode is B<bind>.

=item B<backend_connect_service>

Specify the remote service to connect to when the specified backend_type is
B<udp> and backend_mode is B<bind>.

=back

An example invocation:

=over 4

=item B<--rng egd,backend_host=localhost,backend_service=8000,backend_type=tcp>

Connect to localhost to the TCP port 8000 to get entropy data.

=item B<--rng /dev/random>

Use the /dev/random device to get entropy data, this form implicitly uses the
"random" model.

1617
Use --rng=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsRng>
1618 1619 1620

=back

1621
=item B<--panic> MODEL[,OPTS]
1622 1623 1624 1625 1626

Attach a panic notifier device to the guest. For the recommended settings, use:

--panic default

1627
Use --panic=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsPanic>
1628

1629 1630 1631 1632
=item B<--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.
1633

1634
Use --memdev=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsMemory>.
1635 1636


1637 1638
=back

1639
=head1 MISCELLANEOUS OPTIONS
1640

1641
=over 4
1642

1643
=item B<-h>
1644

1645
=item B<--help>
1646

1647
Show the help message and exit
1648

1649
=item B<--version>
1650

1651
Show program's version number and exit
1652

1653
=item B<--autostart>
1654

1655 1656 1657
Set the autostart flag for a domain. This causes the domain to be started
on host boot up.

1658 1659 1660 1661 1662 1663 1664
=item B<--transient>

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:
1665 1666 1667 1668 1669 1670 1671 1672
L<https://wiki.libvirt.org/page/VM_lifecycle#Transient_guest_domains_vs_Persistent_guest_domains>

=item B<--destroy-on-exit>

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.
1673

1674 1675 1676 1677 1678
=item B<--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).
1679

1680
=item B<--noreboot>
1681 1682 1683 1684

Prevent the domain from automatically rebooting after the install has
completed.

1685
=item B<--wait> WAIT
1686 1687 1688 1689 1690 1691 1692 1693 1694

Amount of time to wait (in minutes) for a VM to complete its install.
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. Any negative
value will make virt-install wait indefinitely, a value of 0 triggers the
same results as noautoconsole. If the time limit is exceeded, virt-install
simply exits, leaving the virtual machine in its current state.

1695
=item B<--dry-run>
1696 1697 1698 1699 1700 1701

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.

1702 1703 1704 1705 1706 1707 1708
=item B<--check>

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.

=item B<-q>

=item B<--quiet>
1709 1710 1711

Only print fatal error messages.

1712 1713 1714
=item B<-d>

=item B<--debug>
1715 1716

Print debugging information to the terminal when running the install process.
1717 1718
The debugging information is also stored in
C<~/.cache/virt-manager/virt-install.log> even if this parameter is omitted.
1719 1720 1721 1722 1723

=back

=head1 EXAMPLES

1724
Install a Fedora 20 KVM guest with virtio accelerated disk/network,
1725
creating a new 10GiB qcow2 file, installing from media in the hosts
1726 1727
CDROM drive. This will use Spice graphics by default, and launch autolaunch
a graphical client.
1728 1729 1730 1731 1732

  # virt-install \
       --connect qemu:///system \
       --virt-type kvm \
       --name demo \
1733
       --memory 500 \
1734
       --disk size=10 \
1735 1736 1737 1738
       --cdrom /dev/cdrom \
       --os-variant fedora13

Install a Fedora 9 plain QEMU guest, using LVM partition, virtual networking,
1739
booting from PXE, using VNC server/viewer, with virtio-scsi disk
1740 1741 1742 1743

  # virt-install \
       --connect qemu:///system \
       --name demo \
1744
       --memory 500 \
1745 1746
       --disk path=/dev/HostVG/DemoVM,bus=scsi \
       --controller virtio-scsi \
1747
       --network network=default \
1748
       --virt-type qemu \
1749 1750 1751 1752 1753 1754 1755 1756
       --graphics vnc \
       --os-variant fedora9

Run a Live CD image under Xen fullyvirt, in diskless environment

  # virt-install \
       --hvm \
       --name demo \
1757
       --memory 500 \
1758
       --disk none \
1759 1760 1761 1762 1763
       --livecd \
       --graphics vnc \
       --cdrom /root/fedora7live.iso

Run /usr/bin/httpd in a linux container guest (LXC). Resource usage is capped
1764
at 512 MiB of ram and 2 host cpus:
1765 1766 1767 1768

  # virt-install \
        --connect lxc:/// \
        --name httpd_guest \
1769
        --memory 512 \
1770 1771 1772
        --vcpus 2 \
        --init /usr/bin/httpd

1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786
Start a linux container guest(LXC) with a private root filesystem,
using /bin/sh as init.
Container's root will be under host dir /home/LXC.
The host dir "/home/test" will be mounted at
"/mnt" dir inside container:

  # virt-install \
        --connect lxc:/// \
        --name container \
        --memory 128 \
        --filesystem /home/LXC,/ \
        --filesystem /home/test,/mnt \
        --init /bin/sh

1787
Install a paravirtualized Xen guest, 500 MiB of RAM, a 5 GiB of disk, and
1788 1789 1790 1791 1792 1793
Fedora Core 6 from a web server, in text-only mode, with old style --file
options:

  # virt-install \
       --paravirt \
       --name demo \
1794
       --memory 500 \
1795
       --disk /var/lib/xen/images/demo.img,size=6 \
1796
       --graphics none \
1797
       --location https://download.fedora.redhat.com/pub/fedora/linux/core/6/x86_64/os/
1798 1799 1800 1801 1802 1803

Create a guest from an existing disk image 'mydisk.img' using defaults for
the rest of the options.

  # virt-install \
       --name demo \
1804
       --memory 512 \
1805 1806 1807
       --disk /home/user/VMs/mydisk.img \
       --import

1808
Start serial QEMU ARM VM, which requires specifying a manual kernel.
1809 1810

  # virt-install \
1811 1812 1813 1814 1815
       --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" \
1816
       --graphics none
1817 1818 1819

=head1 BUGS

1820
Please see https://virt-manager.org/page/BugReporting
1821 1822 1823

=head1 COPYRIGHT

1824
Copyright (C) Red Hat, Inc, and various contributors.
1825
This is free software. You may redistribute copies of it under the terms of
1826
the GNU General Public License C<https://www.gnu.org/licenses/gpl.html>. There
1827 1828 1829 1830
is NO WARRANTY, to the extent permitted by law.

=head1 SEE ALSO

1831
C<virsh(1)>, C<virt-clone(1)>, C<virt-manager(1)>, the project website C<https://virt-manager.org>
1832 1833

=cut