Using Virtual Machines
Ole Marggraf
AIfA
Tech Seminar – 05 XII 2014
Basics
Virtualization defines a framework to run an OS within an OS.
Most common solutions today, using full hardware virtualization
Userlevel
I VMWare (commercial), VMWare Player free for private use
I VirtualBox (installed on AIfA workstations)
I available on all OSs
System level
I KVM (runs unmodified system)
I Xen (runs system under own ”Xen kernel”)
Why?
I Run another OS, without full installation on harddisk
(Windows on Linux, Linux on Windows, Linux on MacOS,
etc.)
I Run another distribution or OS Version
(Scientific Linux on Ubuntu, Windows XP on Windows 7,
etc.)
I Run an older/newer version of your distribution
(Ubuntu 8.04 on Ubuntu 14.04, ...)
I Today, even nesting is possible (within limits)
(Windows XP on Debian 8 on Ubuntu 14.04, ...)
I Test different setups quickly
I Can create snapshots to revert back to
I For distributing pre-configured system
Prerequisites
I Low demand on hardware
(typically, overhead by VM engine is <5%), but memory
may be an issue
I Some, like KVM, require special kernel functions for
efficient hardware access
check with cat /proc/cpuinfo for Kernel flags vmx
(Intel) or svm (AMD)
may need activation in BIOS (look for ∼AMD-V/IntelVT)
I VMWare/Virtualbox should run out of the box on any PC
today
Networking
Different networking variants possible
Typically
I NAT (easiest in most cases):
host provides internal DHCP address,
does local NAT mapping to outside world
(comparable to DSL router at home)
I bridged (if fixed IP required):
host passes guest network traffic through to ethernet
device
guest does not see host network, needs to care for
network setup itself (fix IP, DHCP, ...)
I other variants...
For better performance
I Always (!!!) use a local disk for the VM disk image
I Leave some memory to the host system
(on 4GB, leave ∼2GB)
I If possible, use paravirtualized interfaces (aka virtio) for
disk and ethernet
(can be set in the VM configuration)
Careful with disk interface: VM internal device names may
change (sda → vda)
I Install “guest additions” (VirtualBox) / “VMWare Tools”
(VMWare)
Now, let’s play...