KVM

From Dogtag
Revision as of 19:59, 27 July 2018 by Edewata (talk | contribs) (Installing a Guest)

Jump to: navigation, search

Installation

$ dnf install @virtualization

Starting the Service

$ systemctl start libvirtd

Creating a Storage

See Storage Management.

Sparse Raw File

$ rm -f /var/lib/libvirt/images/guest.img
$ truncate --size=10240M /var/lib/libvirt/images/guest.img

QCOW2

$ qemu-img create -f qcow2 /var/lib/libvirt/images/guest.qcow2 10240

Installing a Guest

Installing QCOW2 Image

To create a VM from a QCOW2 image:

$ virt-install --name <name> --memory 1024 --import --disk path=<image> --noautoconsole

Installing Fedora ISO

To create a Fedora 28 VM:

$ virt-install \
    --name fedora \
    --memory 1024 \
    --disk path=/var/lib/libvirt/images/guest.qcow2,size=10 \
    --network bridge=virbr0 \
    --graphics vnc,listen=127.0.0.1,port=5901 \
    --cdrom /var/lib/libvirt/images/Fedora-Workstation-Live-x86_64-28-1.1.iso \
    --noautoconsole

Installing Debian ISO

$ virt-install \
    --name debian \
    --memory 1024 \
    --disk size=10 \
    --cdrom /var/lib/libvirt/images/debian-9.5.0-amd64-netinst.iso

Connecting to VM

Connect with VNC to 127.0.0.1:1.

$ dnf install spice-vdagent
$ systemctl start spice-vdagentd

Running KVM

Start the VM with the following command:

$ virt-manager

References