5.1. Create a guest using virt-install

5.1. Create a guest using virt-install

Instead of virt-manager you can use the virt-install command. virt-install can either be used interactively or in a script to automate the creation of virtual machines. Using virt-install with Kickstart files an unattended installation of virtual machines can be achieved.

If you are using the virt-install CLI command and you select the --vnc option for a graphical installation you will also see the graphical installation screen as shown below.

The virt-install script provides a number of options one can pass on the command line. Below is the output from virt-install -help:

 virt-install -help
usage: virt-install [options]
options:
   -h, --help            show this help message and exit
   -n NAME, --name=NAME  Name of the guest instance
   -r MEMORY, --ram=MEMORY
                         Memory to allocate for guest instance in megabytes
   -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.
   --vcpus=VCPUS         Number of vcpus to configure for your guest
   --check-cpu           Check that vcpus do not exceed physical CPUs and warn
                         if they do.
   --cpuset=CPUSET       Set which physical CPUs Domain can use.
   -f DISKFILE, --file=DISKFILE
                         File to use as the disk image
   -s DISKSIZE, --file-size=DISKSIZE
                         Size of the disk image (if it doesn't exist) in
                         gigabytes
   --nonsparse           Don't use sparse files for disks.  Note that this will
                         be significantly slower for guest creation
   --nodisks             Don't set up any disks for the guest.
   -m MAC, --mac=MAC     Fixed MAC address for the guest; if none or RANDOM is
                         given a random address will be used
   -b BRIDGE, --bridge=BRIDGE
                         Bridge to connect guest NIC to; if none given, will
                         try to determine the default
   -w NETWORK, --network=NETWORK
                         Connect the guest to a virtual network, forwarding to
                         the physical network with NAT
   --vnc                 Use VNC for graphics support
   --vncport=VNCPORT     Port to use for VNC
   --sdl                 Use SDL for graphics support
   --nographics          Don't set up a graphical console for the guest.
   --noautoconsole       Don't automatically try to connect to the guest
                         console
   -k KEYMAP, --keymap=KEYMAP
                         set up keymap for a graphical console
   --accelerat
   --accelerate          Use kernel acceleration capabilities
   --connect=CONNECT     Connect to hypervisor with URI
   --livecd              Specify the CDROM media is a LiveCD
   -v, --hvm             This guest should be a fully virtualized guest
   -c CDROM, --cdrom=CDROM
                         File to use a virtual CD-ROM device for fully
                         virtualized guests
   --pxe                 Boot an installer from the network using the PXE boot
                         protocol
   --os-type=OS_TYPE     The OS type for fully virtualized guests, e.g.
                         'linux', 'unix', 'windows'
   --os-variant=OS_VARIANT
                         The OS variant for fully virtualized guests, e.g.
                         'fedora6', 'rhel5', 'solaris10', 'win2k', 'vista'
   --noapic              Disables APIC for fully virtualized guest (overrides
                         value in os-type/os-variant db)
   --noacpi              Disables ACPI for fully virtualized guest (overrides
                         value in os-type/os-variant db)
   --arch=ARCH           The CPU architecture to simulate
   -p, --paravirt        This guest should be a paravirtualized guest
   -l LOCATION, --location=LOCATION
                         Installation source for paravirtualized guest (eg,
                         nfs:host:/path, http://host/path, ftp://host/path)
   -x EXTRA, --extra-args=EXTRA
                         Additional arguments to pass to the installer with
                         paravirt guests
   -d, --debug           Print debugging information
   --noreboot            Disables the automatic rebooting when the installation
                         is complete.
   --force               Do not prompt for input. Answers yes where applicable,

Note: This documentation is provided {and copyrighted} by Red Hat®, Inc. and is released via the Open Publication License. The copyright holder has added the further requirement that Distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder. The CentOS project redistributes these original works (in their unmodified form) as a reference for CentOS-5 because CentOS-5 is built from publicly available, open source SRPMS. The documentation is unmodified to be compliant with upstream distribution policy. Neither CentOS-5 nor the CentOS Project are in any way affiliated with or sponsored by Red Hat®, Inc.