Results
Measured at the wall jack, including attached UPS, this system consumes just 31 Watts of power while hosting multiple virtual domains on dual cores, ECC memory, and hardware virtualization.
Hardware
HP's ProLiant MicroServer is compact, supports ECC memory and hardware virtualization, is both low power and low cost, and has good linux compatibility. This example uses the Athlon II Neo N36L 1.3GHz version with 4GB RAM (1GB was not enough to split between my virtual domains) and a DVD writer.
Software
64-bit openSUSE 11.3 was chosen both for the host and virtual guests because I'm familiar with it, and because of its support, security, ease of use, and ability to install lean kernels out-of-the-box. The example web server runs Apache, PHP, and PostgreSQL.
Initial ProLiant Setup
- Install RAM and DVD drive.
- Boot into BIOS (F10) and adjust time to UTC.
- Set DVD reader as first in boot order.
- Save and quit.
Host Installation
Boot off the openSUSE DVD and select "Installation" when prompted. I chose the "Minimal Server Selection (Text Mode)" option for low overhead. The partition setup is as follows:
- Swap: 16GB
- Root: 8GB
- Home: (all the rest)
My swap is large because I had trouble with a 2GB partition, and with plenty of room, went big. Root is small because this dom0 will have very little installed - in fact, in its current form, less than 2GB is used. In these examples, home is used for all data (rather than creating another xen partition) to keep things simple.
Installation Settings
Beyond the minimal pre-selected software, I checked "Xen Virtual Machine Host Server" and searched for "emacs-nox" for editing. I then set XEN as the default in Booting. Finally, I enabled and opened SSH under firewall settings.
Virtual Guests
Preparation
Here, all guest images are in /home/xen. As root:
mkdir /home/xen
Make an image of the openSUSE DVD for guest installation:
dd if=/dev/cdrom of=/home/xen/opensuse113.iso
Shrink dom0's memory to make room for guests:
xm mem-set 0 1024
Installation
This guest will be called "gvTESTBED" and networked with a Xen bridge.
mkdir /home/xen/gvTESTBED
Find the bridge name (mine is "br0"):
brctl show
Start guest installation. Here, I'm reserving 512MB memory, not installing graphics (we'll use serial and SSH), and doing a fully-virtualized guest. Man vm-install for more info.
vm-install --vcpus=1 --disk /home/xen/opensuse113.iso,hdc,cdrom,r --disk /home/xen/gvTESTBED/disk0,hda,disk,w --graphics none --memory 512 --max-memory 512 --name gvTESTBED --nic bridge=br0,model=rtl8139 --full-virt --os-type opensuse11
The Guest Console
If you need to re-connect to the guest during installation (I did), use virsh and its console command (I found virsh console friendlier than xm console). Within virsh:
- help - print a list of commands.
- list - list known guests.
- console x - connect to guest x's console. Control-] disconnects.
- start x, poweroff x
- autostart x - have x start automatically when the host starts.
Guest OS
The virtual machine is again a minimal server install. I chose an 8GB disk size, with 1GB swap, 3GB root, and 4GB home. Additional software:
- yast2-http-server
- postgresql, postgresql-server
- apache2, apache2-doc, apache2-example-pages, apache2-mod_php5
- php5, php5-pgsql, php5-openssl, php5-mcrypt, php5-zlib
- emacs-nox
Installing through the console had some character translation issues I was not able to correct with PuTTy, but got through installation OK. Here's an example:
Once installation completes you can SSH directly to the guest without any transliation issues. Congratulations, you have a virtualized web server that can be cloned and migrated! With yast2-http-server, you can manage many apache functions from within YaST. PostgreSQL can be started from YaST as well (runlevels), but settings are in .conf files as usual.
