workstation/docs/VirtInstall.txt

62 lines
2.4 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Building a VM with virt-install
Introduction
This assumes that the network will be used in "macvtap" mode. This is
the preferred method, as it is faster than a regular bridge and does
not need any additional network configuration on the host.
The disadvantage of macvtap is that host-to-vm and vm-to-host
communication is blocked. This can be worked around with an
"internal" switch, or by having the macvtap connection bind to a
second interface.
Creating the VM
The following command assumes the OS is "rhel9.1" and the network
card is "eno1". It should be run as the root user or with sudo, and
should be run inside tmux for safety.
virt-install --name rhel9 \
--osinfo rhel9.1 \
--boot uefi \
--cdrom /var/lib/libvirt/isos/rhel-baseos-9.1-x86_64-dvd.iso \
--disk /var/lib/libvirt/rhel9.qcow2,size=20 \
--network type=direct,source=enp2s0,source_mode=bridge \
--graphics vnc \
--console pty,target.type=virtio \
--autoconsole none
Paths and names should be changed as appropriate. The VNC port can be
found for this example by running "virsh vncdisplay rhel9".
Import a VM template
Import a template image with the following command. This makes the
same assumptions as "Creating the VM" above.
virt-install --name rhel9.1 \
--osinfo rhel9.1 \
--boot uefi \
--import \
--disk /var/lib/libvirt/rhel9.qcow2 \
--network type=direct,source=enp2s0,source_mode=bridge \
--graphics vnc \
--console pty,target.type=virtio \
--autoconsole none
Tips
For a virtio network card on Windows machines, add "model=virtio" to
the --network option.
Other useful options are "--memory 4096" for 4 GB RAM, and
"--vcpus 2" for a dual-CPU guest.
A list of supported operating systems can be found by running:
virt-install --osinfo list