5
virt-install - provision new virtual machines
9
B<virt-install> [OPTION]...
13
B<virt-install> is a command line tool for provisioning new virtual machines
14
using the C<libvirt> hypervisor management library. The tool supports both
15
text based & graphical installations, using serial console, SDL graphics
16
or a VNC client/server pair. The guest can be configured to use one or more
17
virtual disks, network interfaces, audio devices, and physical host devices
20
The installation media can be held locally or remotely on NFS, HTTP, FTP
21
servers. In the latter case C<virt-install> will fetch the minimal files
22
necessary to kick off the installation process, allowing the guest
23
to fetch the rest of the OS distribution as needed. PXE booting, and importing
24
an existing disk image (thus skipping the install phase) are also supported.
26
Given suitable command line arguments, C<virt-install> is capable of running
27
completely unattended, with the guest 'kickstarting' itself too. This allows
28
for easy automation of guest installs. An interactive mode is also available
29
with the --prompt option, but this will only ask for the minimum required
34
Most options are not required. Minimum requirements are --name, --ram,
35
guest storage (--disk or --nodisks), and an install option.
41
Show the help message and exit
43
=item --connect=CONNECT
45
Connect to a non-default hypervisor. The default connection is chosen based
46
on the following rules:
52
If running on a host with the Xen kernel (checks against /proc/xen)
56
If running on a bare metal kernel as root (needed for KVM installs)
60
If running on a bare metal kernel as non-root
62
It is only necessary to provide the C<--connect> argument if this default
63
prioritization is incorrect, eg if wanting to use QEMU while on a Xen kernel.
69
=head2 General Options
71
General configuration parameters that apply to all types of guest installs.
75
=item -n NAME, --name=NAME
77
Name of the new guest virtual machine instance. This must be unique amongst
78
all guests known to the hypervisor on the connection, including those not
79
currently active. To re-define an existing guest, use the C<virsh(1)> tool
80
to shut it down ('virsh shutdown') & delete ('virsh undefine') it prior to
81
running C<virt-install>.
83
=item -r MEMORY, --ram=MEMORY
85
Memory to allocate for guest instance in megabytes. If the hypervisor does
86
not have enough free memory, it is usual for it to automatically take memory
87
away from the host operating system to satisfy this allocation.
91
Request a non-native CPU architecture for the guest virtual machine.
92
If omitted, the host CPU architecture will be used in the guest.
94
=item -u UUID, --uuid=UUID
96
UUID for the guest; if none is given a random UUID will be generated. If you
97
specify UUID, you should use a 32-digit hexadecimal number. UUID are intended
98
to be unique across the entire data center, and indeed world. Bear this in
99
mind if manually specifying a UUID
103
Number of virtual cpus to configure for the guest. Not all hypervisors support
104
SMP guests, in which case this argument will be silently ignored
106
=item --cpuset=CPUSET
108
Set which physical cpus the guest can use. C<CPUSET> is a comma separated list of numbers, which can also be specified in ranges. Example:
110
0,2,3,5 : Use processors 0,2,3 and 5
111
1-3,5,6-8 : Use processors 1,2,3,5,6,7 and 8
113
If the value 'auto' is passed, virt-install attempts to automatically determine
114
an optimal cpu pinning using NUMA data, if available.
118
Human readable text description of the virtual machine. This will be stored
119
in the guests XML configuration for access by other applications.
121
=item --security type=TYPE[,label=LABEL]
123
Configure domain security driver settings. Type can be either 'static' or
124
'dynamic'. 'static' configuration requires a security LABEL. Specifying
125
LABEL without TYPE implies static configuration.
133
=head2 Installation Method options
137
=item -c CDROM, --cdrom=CDROM
139
File or device use as a virtual CD-ROM device for fully virtualized guests.
140
It can be path to an ISO image, or to a CDROM device. It can also be a URL
141
from which to fetch/access a minimal boot ISO image. The URLs take the same
142
format as described for the C<--location> argument. If a cdrom has been
143
specified via the C<--disk> option, and neither C<--cdrom> nor any other
144
install option is specified, the C<--disk> cdrom is used as the install media.
146
=item -l LOCATION, --location=LOCATION
148
Installation source for guest virtual machine kernel+initrd pair.
149
The C<LOCATION> can take one of the following forms:
155
Path to a local directory containing an installable distribution image
157
=item nfs:host:/path or nfs://host/path
159
An NFS server location containing an installable distribution image
161
=item http://host/path
163
An HTTP server location containing an installable distribution image
165
=item ftp://host/path
167
An FTP server location containing an installable distribution image
171
Some distro specific url samples:
175
=item Fedora/Red Hat Based
177
http://download.fedoraproject.org/pub/fedora/linux/releases/10/Fedora/i386/os/
181
http://ftp.us.debian.org/debian/dists/etch/main/installer-amd64/
185
http://download.opensuse.org/distribution/11.0/repo/oss/
189
ftp://ftp.uwsg.indiana.edu/linux/mandrake/official/2009.0/i586/
195
Use the PXE boot protocol to load the initial ramdisk and kernel for starting
196
the guest installation process.
200
Skip the OS installation process, and build a guest around an existing
201
disk image. The device used for booting is the first device specified via
202
C<--disk> or C<--file>.
206
Specify that the installation media is a live CD and thus the guest
207
needs to be configured to boot off the CDROM device permanently. It
208
may be desirable to also use the C<--nodisks> flag in combination.
210
=item -x EXTRA, --extra-args=EXTRA
212
Additional kernel command line arguments to pass to the installer when
213
performing a guest install from C<--location>.
215
=item --os-type=OS_TYPE
217
Optimize the guest configuration for a type of operating system (ex. 'linux',
218
'windows'). This will attempt to pick the most suitable ACPI & APIC settings,
219
optimally supported mouse drivers, virtio, and generally accommodate other
220
operating system quirks.
222
By default, virt-install will attempt to auto detect this value from
223
the install media (currently only supported for URL installs). Autodetection
224
can be disabled with the special value 'none'
226
See C<--os-variant> for valid options.
228
=item --os-variant=OS_VARIANT
230
Further optimize the guest configuration for a specific operating system
231
variant (ex. 'fedora8', 'winxp'). This parameter is optional, and does not
232
require an C<--os-type> to be specified.
234
By default, virt-install will attempt to auto detect this value from
235
the install media (currently only supported for URL installs). Autodetection
236
can be disabled with the special value 'none'.
248
=head2 Storage Configuration
252
=item --disk=DISKOPTS
254
Specifies media to use as storage for the guest, with various options. The
255
general format of a disk string is
257
--disk opt1=val1,opt2=val2,...
259
To specify media, the command can either be:
261
--disk /some/storage/path,opt1=val1
263
or explicitly specify one of the following arguments:
269
A path to some storage media to use, existing or not. Existing media can be
270
a file or block device. If installing on a remote host, the existing media
271
must be shared as a libvirt storage volume.
273
Specifying a non-existent path implies attempting to create the new storage,
274
and will require specifyng a 'size' value. If the base directory of the path
275
is a libvirt storage pool on the host, the new storage will be created as a
276
libvirt storage volume. For remote hosts, the base directory is required to be
277
a storage pool if using this method.
281
An existing libvirt storage pool name to create new storage on. Requires
282
specifying a 'size' value.
286
An existing libvirt storage volume to use. This is specified as
291
Other available options:
297
Disk device type. Value can be 'cdrom', 'disk', or 'floppy'. Default is
298
'disk'. If a 'cdrom' is specified, and no install method is chosen, the
299
cdrom is used as the install media.
303
Disk bus type. Value can be 'ide', 'scsi', 'usb', 'virtio' or 'xen'. The
304
default is hypervisor dependent since not all hypervisors support all bus
309
Disk permissions. Value can be 'rw' (Read/Write), 'ro' (Readonly),
310
or 'sh' (Shared Read/Write). Default is 'rw'
314
size (in GB) to use if creating new storage
318
whether to skip fully allocating newly created storage. Value is 'true' or
319
'false'. Default is 'true' (do not fully allocate).
321
The initial time taken to fully-allocate the guest virtual disk (spare=false)
322
will be usually by balanced by faster install times inside the guest. Thus
323
use of this option is recommended to ensure consistently high performance
324
and to avoid I/O errors in the guest should the host filesystem fill up.
328
The cache mode to be used. The host pagecache provides cache memory.
329
The cache value can be 'none', 'writethrough', or 'writeback'.
330
'writethrough' provides read caching. 'writeback' provides
331
read and write caching.
335
Image format to be used if creating managed storage. For file volumes, this
336
can be 'raw', 'qcow2', 'vmdk', etc. See format types in
337
L<http://libvirt.org/storage.html> for possible values.
341
See the examples section for some uses. This option deprecates C<--file>,
342
C<--file-size>, and C<--nonsparse>.
346
Request a virtual machine without any local disk storage, typically used for
347
running 'Live CD' images or installing to network storage (iSCSI or NFS root).
349
=item -f DISKFILE, --file=DISKFILE
351
This option is deprecated in favor of C<--disk path=DISKFILE>.
353
=item -s DISKSIZE, --file-size=DISKSIZE
355
This option is deprecated in favor of C<--disk ...,size=DISKSIZE,...>
359
This option is deprecated in favor of C<--disk ...,sparse=false,...>
367
=head2 Networking Configuration
371
=item -w NETWORK, --network=NETWORK,opt1=val1,opt2=val2
373
Connect the guest to the host network. The value for C<NETWORK> can take
380
Connect to a bridge device in the host called C<BRIDGE>. Use this option if
381
the host has static networking config & the guest requires full outbound
382
and inbound connectivity to/from the LAN. Also use this if live migration
383
will be used with this guest.
387
Connect to a virtual network in the host called C<NAME>. Virtual networks
388
can be listed, created, deleted using the C<virsh> command line tool. In
389
an unmodified install of C<libvirt> there is usually a virtual network
390
with a name of C<default>. Use a virtual network if the host has dynamic
391
networking (eg NetworkManager), or using wireless. The guest will be
392
NATed to the LAN by whichever connection is active.
396
Connect to the LAN using SLIRP. Only use this if running a QEMU guest as
397
an unprivileged user. This provides a very limited form of NAT.
401
If this option is omitted a single NIC will be created in the guest. If
402
there is a bridge device in the host with a physical interface enslaved,
403
that will be used for connectivity. Failing that, the virtual network
404
called C<default> will be used. This option can be specified multiple
405
times to setup more than one NIC.
407
Other available options are:
413
Network device model as seen by the guest. Value can be any nic model supported
414
by the hypervisor, e.g.: 'e1000', 'rtl8139', 'virtio', ...
418
Fixed MAC address for the guest; If this parameter is omitted, or the value
419
C<RANDOM> is specified a suitable address will be randomly generated. For
420
Xen virtual machines it is required that the first 3 pairs in the MAC address
421
be the sequence '00:16:3e', while for QEMU or KVM virtual machines it must
428
Request a virtual machine without any network interfaces.
430
=item -b BRIDGE, --bridge=BRIDGE
432
This parameter is deprecated in favour of
433
C<--network bridge=bridge_name>.
435
=item -m MAC, --mac=MAC
437
This parameter is deprecated in favour of C<--network NETWORK,mac=12:34...>
445
=head2 Graphics Configuration
447
If no graphics option is specified, C<virt-install> will default to --vnc
448
if the DISPLAY environment variable is set, otherwise --nographics is used.
454
Setup a virtual console in the guest and export it as a VNC server in
455
the host. Unless the C<--vncport> parameter is also provided, the VNC
456
server will run on the first free port number at 5900 or above. The
457
actual VNC display allocated can be obtained using the C<vncdisplay>
458
command to C<virsh> (or L<virt-viewer(1)> can be used which handles this
461
=item --vncport=VNCPORT
463
Request a permanent, statically assigned port number for the guest VNC
464
console. Use of this option is discouraged as other guests may automatically
465
choose to run on this port causing a clash.
467
=item --vnclisten=VNCLISTEN
469
Address to listen on for VNC connections. Default is typically 127.0.0.1
470
(localhost only), but some hypervisors allow changing this globally (for
471
example, the qemu driver default can be changed in /etc/libvirt/qemu.conf).
472
Use 0.0.0.0 to allow access from other machines.
474
=item -k KEYMAP, --keymap=KEYMAP
476
Request that the virtual VNC console be configured to run with a specific
477
keyboard layout. If the special value 'local' is specified, virt-install
478
will attempt to configure to use the same keymap as the local system. A value
479
of 'none' specifically defers to the hypervisor. Default behavior is
480
hypervisor specific, but typically is the same as 'local'.
484
Setup a virtual console in the guest and display an SDL window in the
485
host to render the output. If the SDL window is closed the guest may
486
be unconditionally terminated.
490
No graphical console will be allocated for the guest. Fully virtualized guests
491
(Xen FV or QEmu/KVM) will need to have a text console configured on the first
492
serial port in the guest (this can be done via the --extra-args option). Xen
493
PV will set this up automatically. The command 'virsh console NAME' can be
494
used to connect to the serial device.
496
=item --noautoconsole
498
Don't automatically try to connect to the guest console. The default behaviour
499
is to launch a VNC client to display the graphical console, or to run the
500
C<virsh> C<console> command to display the text console. Use of this parameter
501
will disable this behaviour.
508
=head2 Virtualization Type options
510
Options to override the default virtualization type choices.
516
Request the use of full virtualization, if both para & full virtualization are
517
available on the host. This parameter may not be available if connecting to a
518
Xen hypervisor on a machine without hardware virtualization support. This
519
parameter is implied if connecting to a QEMU based hypervisor.
523
This guest should be a paravirtualized guest. If the host supports both
524
para & full virtualization, and neither this parameter nor the C<--hvm>
525
are specified, this will be assumed.
529
The hypervisor to install on. Example choices are kvm, qemu, xen, or kqemu.
530
Availabile options are listed via 'virsh capabilities' in the <domain> tags.
534
Prefer KVM or KQEMU (in that order) if installing a QEMU guest. This behavior
535
is now the default, and this option is deprecated. To install a plain QEMU
536
guest, use '--virt-type qemu'
540
Override the OS type / variant to disables the APIC setting for fully
545
Override the OS type / variant to disables the ACPI setting for fully
554
=head2 Device Options
558
=item --host-device=HOSTDEV
560
Attach a physical host device to the guest. Some example values for HOSTDEV:
564
=item B<--host-device pci_0000_00_1b_0>
566
A node device name via libvirt, as shown by 'virsh nodedev-list'
568
=item B<--host-device 001.003>
570
USB by bus, device (via lsusb).
572
=item B<--host-device 0x1234:0x5678>
574
USB by vendor, product (via lsusb).
576
=item B<--host-device 1f.01.02>
578
PCI device (via lspci).
582
=item --soundhw MODEL
584
Attach a virtual audio device to the guest. MODEL specifies the emulated
585
sound card model. Possible values are ac97, es1370, sb16, pcspk, or default.
586
'default' willl be AC97 if the hypervisor supports it, otherwise it will be
589
This deprecates the old boolean --sound model (which still works the same
590
as a single '--soundhw default')
592
=item --watchdog MODEL[,action=ACTION]
594
Attach a virtual hardware watchdog device to the guest. This requires a
595
daemon and device driver in the guest. The watchdog fires a signal when
596
the virtual machine appears to hung. ACTION specifies what libvirt will do
597
when the watchdog fires. Values are
603
Forcefully reset the guest (the default)
607
Forcefully power off the guest
619
Gracefully shutdown the guest (not recommended, since a hung guest probably
620
won't respond to a graceful shutdown)
624
MODEL is the emulated device model: either i6300esb (the default) or ib700.
627
Use the recommended settings:
631
Use the i6300esb with the 'poweroff' action
633
--watchdog i6300esb,action=poweroff
635
=item --parallel=CHAROPTS
637
=item --serial=CHAROPTS
639
Specifies a serial device to attach to the guest, with various options. The
640
general format of a serial string is
642
--serial type,opt1=val1,opt2=val2,...
644
--serial and --parallel devices share all the same options, unless otherwise
645
noted. Some of the types of character device redirection are:
649
=item B<--serial pty>
651
Pseudo TTY. The allocated pty will be listed in the running guests XML
654
=item B<--serial dev,path=HOSTPATH>
656
Host device. For serial devices, this could be /dev/ttyS0. For parallel
657
devices, this could be /dev/parport0.
659
=item B<--serial file,path=FILENAME>
661
Write output to FILENAME.
663
=item B<--serial pipe,path=PIPEPATH>
665
Named pipe (see pipe(7))
667
=item B<--serial tcp,host=HOST:PORT,mode=MODE,protocol=PROTOCOL>
669
TCP net console. MODE is either 'bind' (wait for connections on HOST:PORT)
670
or 'connect' (send output to HOST:PORT), default is 'connect'. HOST defaults
671
to '127.0.0.1', but PORT is required. PROTOCOL can be either 'raw' or 'telnet'
672
(default 'raw'). If 'telnet', the port acts like a telnet server or client.
675
Connect to localhost, port 1234:
677
--serial tcp,host=:1234
679
Wait for connections on any address, port 4567:
681
--serial tcp,host=0.0.0.0:4567,mode=bind
683
Wait for telnet connection on localhost, port 2222. The user could then
684
connect interactively to this console via 'telnet localhost 2222':
686
--serial tcp,host=:2222,mode=bind,protocol=telnet
688
=item B<--serial udp,host=CONNECT_HOST:PORT,bind_port=BIND_HOST:BIND_PORT>
690
UDP net console. HOST:PORT is the destination to send output to (default
691
HOST is '127.0.0.1', PORT is required. BIND_HOST:PORT is the optional local
692
address to bind to (default BIND_HOST is 127.0.0.1, but is only set if
693
BIND_PORT is specified.) Some examples:
695
Send output to default syslog port (may need to edit /etc/rsyslog.conf
698
--serial udp,host=:514
700
Send output to remote host 192.168.10.20, port 4444 (this output can be
701
read on the remote host using 'nc -u -l 4444':
703
--serial udp,host=192.168.10.20:4444
705
=item B<--serial unix,path=UNIXPATH,mode=MODE>
707
Unix socket (see unix(7). MODE has similar behavior and defaults as 'tcp'.
713
Specify what video device model will be attached to the guest. Valid values
714
for VIDEO are hypervisor specific, but some options for recent kvm are
715
cirrus, vga, or vmvga (vmware).
723
=head2 Miscellaneous Options
729
Set the autostart flag for a domain. This causes the domain to be started
734
Prevent the domain from automatically rebooting after the install has
739
Amount of time to wait (in minutes) for a VM to complete its install.
740
Without this option, virt-install will wait for the console to close (not
741
neccessarily indicating the guest has shutdown), or in the case of
742
--noautoconsole, simply kick off the install and exit. Any negative
743
value will make virt-install wait indefinitely, a value of 0 triggers the
744
same results as noautoconsole. If the time limit is exceeded, virt-install
745
simply exits, leaving the virtual machine in its current state.
749
Prevent interactive prompts. If the intended prompt was a yes/no prompt, always
750
say yes. For any other prompts, the application will exit.
754
Specifically enable prompting for required information. Default prompting
755
is off (as of virtinst 0.400.0)
759
Check that the number virtual cpus requested does not exceed physical CPUs and
764
Print debugging information to the terminal when running the install process.
765
The debugging information is also stored in C<$HOME/.virtinst/virt-install.log>
766
even if this parameter is omitted.
772
Install a KVM guest (assuming proper host support), creating a new
773
storage file, virtual networking, booting from the host CDROM, using
777
--connect qemu:///system \
780
--disk path=/var/lib/libvirt/images/demo.img,size=5 \
781
--network network=default,model=virtio \
785
Install a Fedora 9 plain QEMU guest, using LVM partition, virtual networking,
786
booting from PXE, using VNC server/viewer
789
--connect qemu:///system \
792
--disk path=/dev/HostVG/DemoVM \
793
--network network=default \
798
Install a guest with a real partition, with the default QEMU hypervisor for
799
a different architecture using SDL graphics, using a remote kernel and initrd
803
--connect qemu:///system \
806
--disk path=/dev/hdc \
807
--network bridge=eth1 \
810
--location http://download.fedora.redhat.com/pub/fedora/linux/core/6/x86_64/os/
812
Run a Live CD image under Xen fullyvirt, in diskless environment
821
--cdrom /root/fedora7live.iso
823
Install a paravirtualized Xen guest, 500 MB of RAM, a 5 GB of disk, and
824
Fedora Core 6 from a web server, in text-only mode, with old style --file
831
--file /var/lib/xen/images/demo.img \
834
--location http://download.fedora.redhat.com/pub/fedora/linux/core/6/x86_64/os/
836
Create a guest from an existing disk image 'mydisk.img' using defaults for
837
the rest of the options.
842
--disk /home/user/VMs/mydisk.img
847
Written by Daniel P. Berrange, Hugh Brock, Jeremy Katz, Cole Robinson and a
848
team of many other contributors. See the AUTHORS file in the source
849
distribution for the complete list of credits.
853
Please see http://virt-manager.org/page/BugReporting
857
Copyright (C) 2006-2009 Red Hat, Inc, and various contributors.
858
This is free software. You may redistribute copies of it under the terms of
859
the GNU General Public License C<http://www.gnu.org/licenses/gpl.html>. There
860
is NO WARRANTY, to the extent permitted by law.
864
C<virsh(1)>, C<virt-clone(1)>, C<virt-manager(1)>, the project website C<http://virt-manager.org>