UPDATE – The Purge…

So following instructions isn’t enough apparantly. Connecting to the server with XenCenter opened my eyes.

A) To use local disks, you have to use a cli utility that doesn’t seem to work properly for me (thinks /dev/sda1 is for sure in use when it actually is not) and seems to not understand anything but an LVM setup. Now yes, I didn’t do LVM when I installed Xen but seriously?…why are there these restrictions when all I want to do is run VM’s on a decent hypervisor with a decent client/web gui?

B) When I go to create a VM in XenCenter, it shows literally nothing under the templates section which means it doesn’t let me continue with out one. Looking on t3h googles, this doesn’t seem normal at all and apparantly no one ever in the world has run into this problem. I checked and yep, the xen-guest-templates package was indeed installed.

C) Networking…meh whatever: When booting the Xen kernel, almost every other time, networking would either work, or not work. Because that is totally something I don’t need working all the time.

D)

apt-get purge xen*

E)

apt-get install kvm libvirt0

F) More to come on KVM…

——– Original Article
So until yesterday, I didn’t even know Debian 7 was out!! Since I’ve decided to use my mac exclusively as my main workstation machine, my main desktop will now become my new “quiter and power saving” server.

One of the first things I did was decide I wanted to get some virtual machines going. At first I thought ESXi….but I discovered quickly that if the installer sits at the loading kernel part for too long, it most likely doesn’t like your hardware and is trying to be nice about telling you about it.

So, I looked over to Xen. It’s free, used everywhere, and has a fairly easy time installing on ubuntu/debian based systems. Let me explain exactly how it works:

Xen is certainly a “bare-metal” Type 1 hypervisor meaning it does actually run just like ESXi does but along side of whatever base OS you installed. In our case, this will be Debian. Basically, at boot, the Xen hypervisor is booted which then in turn launches the Debian kernel etc..

Xen comes in a couple flavors. The one we will be using is the free Xen Cloud Platform (OSS and free as opposed to Xen Server, for the corporate world). We will also install the XenAPI/xapi tools enabling us to use things like XenCenter (think vsphere, a gui client for managing stuffs) or OpenXenManager.

So lets get started!

1) Install Debian 7 any way you want it…thats the way you need it. (yeah journey is awesome)

2) Install our hypervisor itself:

apt-get install xen-linux-system

3) Set Xen to be the default boot options in GRUB:

dpkg-divert –divert /etc/grub.d/08_linux_xen –rename /etc/grub.d/20_linux_xen update-grub

4) I personally wanted to set a memory limit for Xen or else it ballons up using as much as is available. Edit/Add /etc/default/grub with:

GRUB_CMDLINE_XEN=“dom0_mem=1024M”

dropping in however much memory you’d like to allocate.
Ensure you update-grub once again.

Now you must edit /etc/xen/xend-config.sxp with:

(dom0-min-mem 1024) (enable-dom0-ballooning no)

5) I also didn’t want Xen to utilize all my CPU’s (think core’s here as well) in the event that VM’s took up to much CPU time. To change this , add the following to the end of your /etc/default/grub file:

dom0_max_vcpus=1 dom0_vcpus_pin

and then edit the /etc/xen/xend-config.sxp file:

(dom0-cpus 1)

6) If you would like your VM’s to actually go through a shut down instead of Xen to just pause/hibernate them when you shutdown the host, edit/set these parameters in /etc/default/xendomains:

XENDOMAINS_RESTORE=false XENDOMAINS_SAVE=“”

7) I highly suggest you run a update-grub and then reboot at this point to ensure everything gets set in stone with grub and xen.

Next: Xen-tools – these are basically sets of scripts that enable you to easily create configured guest domains/hosts/vms.

1)

apt-get install xen-tools

2) edit /etc/xen-tools/xen-tools.conf for anything you might want to change with its default image creation script. In here, you can also change the directory where domU images (I presume vm’s) are stored. You can find more on the interwebz. I have not really done much yet with this but I’ll post as I learn more.

This post will be edited soon for info on xenapi.

This guide uses most of its Xen installation resources and information from here.

Mario Loria is a builder of diverse infrastructure with modern workloads on both bare-metal and cloud platforms. He's traversed roles in system administration, network engineering, and DevOps. You can learn more about him here.