Installation (No X11)

# Install prerequirements (ignore virtinst if you have x11)
sudo apt-get install qemu-kvm libvirt-bin virtinst

sudo usermod -aG kvm $USER
sudo usermod -aG libvirt $USER

Creating a new host (i.e. guest)

# NAME-OF-VHOST is whatever you want to call your virtual host
# SIZE-IN-MB is how many MBs of RAM you want to give the new host
# LOCATION is the location to install from, you can find locations by typing `man virt-install`
# NAME-OF-DISK is what disk you want to provide to the vhost, e.g. a partition

sudo virt-install --virt-type kvm --name NAME-OF-VHOST --memory SIZE-IN-MB --location LOCATION --extra-args "console=ttyS0" --disk /dev/NAME-OF-DISK

# Example
sudo virt-install --virt-type=kvm --name david2 --memory 16384 --location http://ftp.us.debian.org/debian/dists/stable/main/installer-amd64/ --disk /dev/vg0/lv1 --extra-args "console=ttyS0"

# Example (ISO-file and vnc graphics)
sudo virt-install --virt-type=kvm --name bleach --memory 4096 --disk /dev/vg0/lv5 --cdrom Fedora-Server-netinst-x86_64-27-1.6.iso --graphics=vnc,listen=127.0.0.1,password=verysecret

Bridge guest to host network

Add network interface

In /etc/network/interfaces, change from

allow-hotplug eth0
iface eth0 inet dhcp

Change to

allow-hotplug eth0
iface eth0 inet manual

auto br0
iface br0 inet dhcp
        bridge_ports eth0
        bridge_stp off
        bridge_fd 0
        bridge_maxwait 0

And reset the network

sudo ifdown eth0
sudo ifup eth0
sudo ifup br0

In virsh

Connect to virsh

virsh --connect qemu:///system

Edit vm’s xml

edit david2

Change from

<interface type='network'>
  <mac address='52:54:00:24:ec:d9'/>
  <source network='default'/>
  <model type='rtl8139'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</interface>

Change to

<interface type='bridge'>
  <mac address='52:54:00:24:ec:d9'/>
  <source bridge='br0'/>
</interface>

Restart vm

shutdown david2
start david2