Доки, маны, напоминалки

man virt-install

Posted on Январь 10, 2011

virt-install(1) - Linux man page


virt-install - provision new virtual machines


virt-install [ OPTION ]...


virt-install is a command line tool for provisioning new virtual machines using the "libvirt" hypervisor management library. The tool supports both text based & graphical installations, using serial console, SDL graphics or a VNC client/server pair. The guest can be configured with one or more virtual disks and network interfaces plumbed through to the host.

The installation media can be held locally or remotely on NFS , HTTP , FTP servers. In the latter case "virt-install" will fetch the minimal files necessary to kick off the installation process, allowing the guest to fetch the rest of the OS distribution as needed.

Given suitable command line arguments, "virt-install" is capable of running completely unattended, with the guest 'kickstarting' itself too. This allows for easy automation of guest installs. A companion tool "virt-clone(1)" is provided for cloning pre-existing guests if their installation cannot be easily automated from pristine media.


Any of the options can be omitted, in which case "virt-install" will run interactively prompting for input as required.

-h, --help
Show the help message and exit
-n NAME , --name=NAME
Name of the new guest virtual machine instance. This must be unique amongst all guests known to the hypervisor on this machine, including those not currently active. To re-define an existing guest, use the virsh(1) tool to shut it down & delete it prior to running "virt-install". This parameter will be prompted for if omitted on the command line.
-r MEMORY , --ram=MEMORY
Memory to allocate for guest instance in megabytes. If the hypervisor does not have enough free memory, it is usual for it to automatically take memory away from the host operating system to satisfy this allocation. This parameter will be prompted for if omitted on the command line.
-u UUID , --uuid=UUID
UUID for the guest; if none is given a random UUID will be generated. If you specify UUID , you should use a 32-digit hexadecimal number. UUID are intended to be unique across the entire data center, and indeed world. Bear this in mind if manually specifying a UUID
Number of virtual cpus to configure for the guest. Not all hypervisors support SMP guests, in which case this argument will be silently ignored
Check that the number virtual cpus requested does not exceed physical CPUs and warn if they do.
Set which physical cpus the guest can use. "CPUSET" is a comma separated list of numbers, which can also be specified in ranges. Example:

0,2,3,5     : Use processors 0,2,3 and 5
1-3,5,6-8   : Use processors 1,2,3,5,6,7 and 8
Path to the file, disk partition, or logical volume to use as the backing store for the guest's virtual disk. If the path does not exist, then "--file-size" option should also be specified, allowing the disk to be created. This parameter can be repeated multiple times to add many disk. This parameter will be prompted for if omitted on the command line.
-s DISKSIZE , --file-size=DISKSIZE
Size of the file to create for the guest virtual disk, if the path given to "--file" does not already exist. The size is to be specified in gigabytes, with fractional numbers allowed. The storage for the file will not be pre-allocated unless the "--nonsparse" option is also specified. This parameter will be prompted for if omitted on the command line & a new file is to be created.
Request creation of a non-sparse file for the guest virtual disk. The initial time taken to fully-allocate the guest virtual disk will be usually by balanced by faster install times inside the guest. Thus use of this optional is recommended to ensure consistently high performance and to avoid I/O errors in the guest should the host filesystem fill up.
Request a virtual machine without any local disk storage, typically used for running 'Live CD ' images or installing to network storage (iSCSI or NFS root). This disables all interactive prompts for disk setup.
-m MAC , --mac=MAC
Fixed MAC address for the guest; If this parameter is omitted, or the value "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 '54:52:00'.
-b BRIDGE , --bridge=BRIDGE
Bridge device to connect the guest NIC to. This parameter is deprecated in favour of the "--network" parameter.
-w NETWORK , --network=NETWORK
Connect the guest to the host network. The value for "NETWORK" can take one of 3 formats:
Connect to a bridge device in the host called "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.
Connect to a virtual network in the host called "NAME". Virtual networks can be listed, created, deleted using the "virsh" command line tool. In an unmodified install of "libvirt" there is usually a virtual network with a name of "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.
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 .
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 "default" will be used. This option can be specified multiple times to setup more than one NIC .
Setup a virtual console in the guest and export it as a VNC server in the host. Unless the "--vncport" 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 "vncdisplay" command to "virsh". If neither this, nor the "--sdl" or "--nographics" parameters are specified, this will be prompted for.
Request a permanent, statically assigned port number for the guest VNC console. Use of this option is discouraged as other guests may automatically choose to run on this port causing a clash.
Setup a virtual console in the guest and display an SDL window in the host to render the output. If the SDL window is closed the guest may be unconditionally terminated.
Disable all interactive prompts for the guest virtual console. No graphical console will be allocated for the guest. A text based console will always be available on the first serial port (or equivalent paravirtualised console device).
Don't automatically try to connect to the guest console. The default behaviour is to launch a VNC client to display the graphical console, or to run the "virsh" "console" command to display the text console. Use of this parameter will disable this behaviour.
-k KEYMAP , --keymap=KEYMAP
Request that the virtual console be configured to run with a non-English keyboard layout.
When installing a QEMU guest, make use of the KVM or KQEMU kernel acceleration capabilities if available. Use of this option is recommended unless a guest OS is known to be incompatible with the accelerators. The KVM accelerator is preferred over KQEMU if both are available.
--connect=CONNECT Connect to hypervisor with URI
Connect to a non-default hypervisor. The default connection is chosen based on the following rules:
xenIf running on a host with the Xen kernel (checks against /proc/xen)

If running on a bare metal kernel as root
If running on a bare metal kernel as non-root
It is only necessary to provide the "--connect" argument if this default prioritization is incorrect, eg if wanting to use QEMU while on a Xen kernel.
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 may be desirable to also use the "--nodisks" flag in combination.
-v, --hvm This guest should be a fully virtualized guest
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.
-c CDROM , --cdrom=CDROM
File to use a virtual CD-ROM device for fully virtualized guests. 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 "--location" argument. If this parameter is omitted then the "--location" argument must be given to specify a location for the kernel and initrd, or the "--pxe" argument used to install from the network.
Use the PXE boot protocol to load the initial ramdisk and kernel for starting the guest installation process. If this parameter is omitted then either the "--location" or "--cdrom" arguments must be given to specify a location for the kernel and initrd.
Optimize the guest configuration for a type of operating system. This will attempt to pick the most suitable ACPI & APIC settings, optimally supported mouse drivers and generally accommodate other operating system quirks. The valid operating system types are
Linux 2.x series
Microsoft Windows 9x or later
Traditional UNIX BSD or SysV derivatives
Operating systems not in one of the 3 prior groups
Further optimize the guest configuration for a specific operating system variant. This parameter is optional. The valid variants are
Red Hat Enterprise Linux 2.1
Red Hat Enterprise Linux 3
Red Hat Enterprise Linux 4
Red Hat Enterprise Linux 5
Cent OS 5
Fedora Core 5
Fedora Core 6
Fedora 7
Suse Linux Enterprise Server 10.x
Debian 4.0 (Etch)
Debian Lenny
Generic Linux 2.6.x kernel
Generic Linux 2.4.x kernel
Microsoft Windows XP
Microsoft Windows 2000
Microsoft Windows 2003
Microsoft Windows Vista
Sun Solaris 9
Sun Solaris 10
Free BSD 6.x
Open BSD 4.x
Microsoft DOS
Novell Netware 4
Novell Netware 5
Novell Netware 6
Override the OS type / variant to disables the APIC setting for fully virtualized guest.
Override the OS type / variant to disables the ACPI setting for fully virtualized guest.
Request a non-native CPU architecture for the guest virtual machine. The option is only currently available with QEMU guests, and will not enable use of acceleration. If omitted, the host CPU architecture will be used in the guest.
-p, --paravirt
This guest should be a paravirtualized guest. If the host supports both para & full virtualization, and neither this parameter nor the "--hvm" are specified, this will be prompted for interactively.
-l LOCATION , --location=LOCATION
Installation source for guest virtual machine kernel+initrd pair. This is required for paravirtualized guests. Fully virtualized guests must use either "--location" to specify a kernel+initrd, or the "--cdrom" parameter to specify an ISO/CDROM image. The "LOCATION" can take one of the following forms:
Path to a local directory containing an installable distribution image
nfs:host:/path or nfs://host/path
An NFS server location containing an installable distribution image
An HTTP server location containing an installable distribution image
An FTP server location containing an installable distribution image
-x EXTRA , --extra-args=EXTRA
Additional kernel command line arguments to pass to the installer when performing a guest install from a kernel+initrd.
-d, --debug
Print debugging information to the terminal when running the install process. The debugging information is also stored in "$HOME/.virtinst/virt-install.log" even if this parameter is omitted.


Install a paravirtualized Xen guest, 500 MB of RAM , a 5 GB of disk, and Fedora Core 6 from a web server, in text-only mode:

# virt-install \
     --paravirt \
     --name demo \
     --ram 500 \
     --file /var/lib/xen/images/demo.img \
     --file-size 6 \
     --nographics \
     --location http://download.fedora.redhat.com/pub/fedora/linux/core/6/x86_64/os/

Install a QEMU guest, with a real partition, for a different architecture using SDL graphics, using a local ISO image:

# virt-install \
     --connect qemu:///system \
     --name demo \
     --ram 500 \
     --file /dev/hdc \
     --network bridge:eth1 \
     --arch ppc64 \
     --sdl \
     --cdrom /root/boot.iso

Install a QEMU guest, with a real partition, for a different architecture using SDL graphics, using a remote kernel and initrd pair:

# virt-install \
     --connect qemu:///system \
     --name demo \
     --ram 500 \
     --file /dev/hdc \
     --network bridge:eth1 \
     --arch ppc64 \
     --sdl \
     --location http://download.fedora.redhat.com/pub/fedora/linux/core/6/x86_64/os/

Install a KVM guest, using LVM partition, virtual networking, booting from the host CDROM , using VNC server/viewer

# virt-install \
     --connect qemu:///system \
     --name demo
     --ram 500 \
     --file /dev/HostVG/DemoVM \
     --network network:default \
     --accelerate \
     --vnc \
     --cdrom /dev/cdrom

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

# virt-install \
     --hvm \
     --name demo \
     --ram 500 \
     --nodisk \
     --livecd \
     --vnc \
     --cdrom /root/fedora7live.iso

Комментарии (0) Пинги (0)

Пока нет комментариев.

Leave a comment


Trackbacks are disabled.