Fedora 29: Install KVM for virtualization

This article will describe installing KVM.

1 Install qemu-kvm and libvirt

Install qemu-kvm package and some packages for virtual machine operation.

$ sudo dnf install -y qemu-kvm virt-manager virt-install

The user in libvirt group can run virt-manager without sudo.

$ sudo gpasswd -a "${USER}" libvirt
$ echo "export VIRSH_DEFAULT_CONNECT_URI=qemu:///system" \
>> ~/.bash_profile
$ sudo reboot

2 VNC port

Allow VNC port with using vnc-server.xml so that other machine can access virtual machine.

$ sudo cat /usr/lib/firewalld/services/vnc-server.xml
<?xml version="1.0" encoding="utf-8"?>
  <short>Virtual Network Computing Server (VNC)</short>
  <description>A VNC server provides an external accessible X
session. Enable this option if you plan to provide a VNC server with
direct access. The access will be possible for displays :0 to :3. If
you plan to provide access with SSH, do not open this option and use
the via option of the VNC viewer.</description>
  <port protocol="tcp" port="5900-5903"/>

Allow VNC port.

$ sudo firewall-cmd --add-service=vnc-server --permanent
$ sudo firewall-cmd --reload

3 Enable kvm_intel nested

If Enable kvm_intel nested, you can create nested virtual machine on virtual machine.

$ echo "options kvm_intel nested=1" | \
  sudo tee /etc/modprobe.d/qemu-system-x86.conf
$ sudo reboot