Not ready for others to use.
Introduction
Google Cloud's Compute Engine uses KVM as the hypervisor. Nuff said in terms of longevity, security and support. The other advantage and reason I settled on KVM is that unlike other hypervisors it works with pretty much any hardware (which I found out the hard way trying to get my old Dell laptop working with other options first).
What is outlined here can be considered foundational home Cloud to gain an under the hoods look at Google Cloud engine.
Setup Server
Setup Ubuntu Server on Dell laptop (really don't use Dell because it has various challenges... ).
I initially did this using seutpadmin (and noticed after that it somehow got added to the group libvirtd)... which is required to manage libvirtd.
This is a true server, so no GUI to keep down maintenance.
Install KVM using Ubuntu instructions. Will manage using VirtManager.
To get things going here simply... do not setup ssh key only authentication yet. Instead just enable key authentication, (keep line x commented out) and you will have both password and key authentication working.
Setup Accounts linked to libvirtd
It looks like by default the account used to install KVM gets added to the group libvirtd (to confirm this).
If you want an account to manage KVM, you must add the group libvirtd to the account on the Hypervisor host. In this case, I would like my staff account tin.pham for both local and later remove client administration of KVM.
In keeping things simple, I do not start out with tin.pham enabled to use ssh key authentication.
Setup Client Manager on Separate Machine
Best to use Ubuntu default Desktop. I'm using the Ubuntu default desktop in a VMWare Fusion on my iMac (link to this as separate article where the Ubuntu desktop is also stripped down).
I like consistency, but you don't need to do same... I plan to manage with tin.pham so I create the exact same user with same id. Note it looks like the (period) in tin.pham causes a bug in the gui Desktop so I manually create the user and add the groups required,
# to put instructions here... but basically create at terminal like normal, then look at the initial default setup user, in this case setupadmin and replicate the groups
Install Virtual Manager,
sudo apt-get install virt-manager
Install passkey,
Install SSH Ask Pass Addon to Ubuntu Gnome Desktop,
sudo apt-get install ssh-askpass-gnome
Ignore the extra virt-manager login during intial login.
Change some defaults,
Edit, Preferences,
- Polling - enable Poll Memory stats
- New VM - Change graphics type to VNC ... as we are remote managing
Then View, Graph and enable Memory Usage.
Connect for First Time
... instructions from screenshots to put up
... show and talk about error if user account being used does not have libvirtd in groups.
Enable Key Authentication
... then delete and enable authentication
... tip having trouble make sure both passphrase and key work and use two distinct accounts to test
Setup Folder and Upload iso files
Upload ISO images into /var/lib/libvirt/images ... I can customize by modifying gui to add storage pool but what exactly is the concept ?.
/opt/kvm-data/iso-images/
Setup Virtual Machine
There's a tricky thing here "Spice server" to "VNC server" ... look up how to make "VNC server" the default for VM creations.
VNC... Ensure you have good enough resolution... lookup how to refresh vnc screen....
I setup using direct ISO loads.
Ubuntu Desktop
Easy and one via iso load. Just link to slimming down.
Windows 7 64-bit Ultimate Edition
Windows unlike Linux requires virtio drivers to get features for the VM to,
- Release memory
- Improve performance
Note though that I found with VirtIO Disk I lost the ability to take snapshots though with VirtIO Disk... I believe this is just a bug though and will get fixed in the future (July 2017).
...
Download and load the Virtio Floppy Disk (virtio-win amd64 floppy).
Start the Windows 7 setup as normal but you will be prompted the Virtio Hard Disk drivers which you point to on the floppy.
Don't update Windows yet. Shutdown and load Windows 7 ISO (virtio-win iso) from RedHat. Boot up.
Going into device manager you will see something missing, it's the memory driver so load it.
Shutdown again you then need to set the min (current allocation) and max (maximum allocation) to properly use the vritio memory driver). You might want to watch your actual memory usage to determine best min because ballooning likely (need to check) take resources and you also want to not set yourself up to be over allocated if other systems ballon too. For my needs Win 7 I find it usually stays at 1.6GB, so I allocate 1.6GB - 4GB.
Finally, the default realtek network should work, but to get better performance switch to the virtio network card and repeat.
Windows 10
Not supported officially yet. Windows 7 is more than fine given it won't drop support for next few years. Unofficial here,
Finally Good more decent instructions - http://www.techotopia.com/index.php/Creating_a_CentOS_6_KVM_Networked_Bridge_Interface
Instructions - http://bart.vanhauwaert.org/hints/installing-win10-on-KVM.html
Ubuntu KVM Guest Drivers - https://launchpad.net/kvm-guest-drivers-windows/+download
Expose VMs to the Network via Public Bridge
Ubuntu Server
KVM can setup up a Public Bridge during boot of the VM and this can be manipulated using VMM (Virtual Machine Manager).
First confirm the name of your active network card.
(to put instructions here)
Using VMM. Turn off you VM if not already off. Load Information window, choose NIC, change Network source to Host device macvtap. Notice KVM auto generated a unique mac.
Boot and now your VM exists like a real machine on your existing network....
But this is not really a good solution and problematic as I found with Ubuntu Desktop... leading to the real solution which is to use VMM at the higher level and configure a proper bridge.
Finally found the clarity by following instructions at techotopia.com. Note as you follow the VMM GUI instructions you will find VMM will get disconnected after it executes the changes. Just reconnect after the changes are done.
Abridged notes...
- Determine your existing network interface that works, in my case enp2s0.
- Make a new bridge interface we'll call br0
- Make enp2s0 slave to br0
- br0 then is your new primary interface, receiving the host's IP address on your NIC
- But it also is in bridge mode so VMs choosing to use br0 will get their own IP address against the same network via dhcp
You end up with /etc/network/interfaces going from this,
... put original file here...
To this
... to pu here ...
Additionally if you want to use a static IP,
Go from this,
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto enp2s0 iface enp2s0 inet static address 192.168.0.7 netmask 255.255.255.0 gateway 192.168.0.1 dns-nameservers 192.168.0.1
And after using VMM to configure the bridge it should look like this,
This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto br0 iface br0 inet dhcp bridge_ports enp2s0 bridge_stp on bridge_fd 0.0
And then you need to manually edit to give br0 the static ip,
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto br0 iface br0 inet static address 192.168.0.7 netmask 255.255.255.0 gateway 192.168.0.1 dns-nameservers 192.168.0.1 bridge_ports enp2s0 bridge_stp on bridge_fd 0.0
If interested, you may want to read more details about bridge networking for virtualization.
...
Ubuntu Desktop
Did not work retrofitting... so this time trying during vm setup before install,
Network selection, Host device macvtp, Bridge... hmmm what is Passthrough
...
Resource Management
Understanding Dynamic Memory...
Windows zero's memory on boot so uses it all.
Some Linux (check Ubuntu and how LXD goes into this) is smart with balloon drivers which release memory back to host if not used.
References
Hypervisor view of managing resources - http://www.altaro.com/hyper-v/common-hyper-v-deployment-mistakes/
Q&A... Memory aspect was new to new to me - http://www.linux-kvm.org/page/FAQ
Alternative Container Manager and similar to Virtual Machine Manager can also be used for Linux Containers.
This article can help this person... when completed follow-up with a post - https://askubuntu.com/questions/28056/kvm-with-windows-xp