6.2. Creating Guests with virt-install
You can use the
virt-install
command to create guest virtual machines from the command line. virt-install
is used either interactively or as part of a script to automate the creation of virtual machines. Using virt-install
with Kickstart files allows for unattended installation of virtual machines.
The
virt-install
tool provides a number of options that can be passed on the command line. To see a complete list of options run the following command:
virt-install --help
# virt-install --help
Note that you need root privileges in order for
virt-install
commands to complete successfully. The virt-install
man page also documents each command option and important variables.
qemu-img
is a related command which may be used before virt-install
to configure storage options.
An important option is the
--graphics
option which allows graphical installation of a virtual machine.
Example 6.1. Using virt-install to install a Red Hat Enterprise Linux 5 guest virtual machine
This example creates a Red Hat Enterprise Linux 5 guest:
Ensure that you select the correct
os-type
for your operating system when running this command.
Refer to
man virt-install
for more examples.
Note
When installing a Windows guest with
virt-install
, the --os-type=windows
option is recommended. This option prevents the CD-ROM from disconnecting when rebooting during the installation procedure. The --os-variant
option further optimizes the configuration for a specific guest operating system.
After the installation completes, you can connect to the guest operating system. For more information, see Section 6.5, “Connecting to Virtual Machines”