How to use Xen to host application servers which will have application servers on it. Complete Guide for Newbies.

The world of virtualization is quite complicated and takes a little time getting used to. But once you work with for a while it all starts to make sense. I'll compare / contrast the free VMWare products and the Linux / open source equivalents. Hopefully this will will help you understand where Xen fits into the virtualization world.

There are two major ways of doing virtualization (Please don't confuse this with Full-Virtualizaton vs Para-Virtualization - which is described later)
 * 1) Binary translation Hypervisor
 * 2) Bare Metal Hypervisor

-

1. Binary translation Hypervisor Binary translation uses software to translate the instructions in a virtual machine to actual machines instructions on the physical hardware.

Examples:
 * VMWare: VMWare Server
 * Linux:  KVM

Benefits:

You don't need a special system to run virtual machines. You can use use your existing system as is. This method is ideal if you want to experiment with virtualization.

Drawbacks:

Performance may not be as great as the Hypervisor method, and it's probably not going to scale as well when you start working with many virtual machines.

2. Bare Metal Hypervisor method A Bare Metal Hypervisor is a special kernel that handles virtual machines. Instead of a binary translator, the special kernel does the translation. But being closer to the hardware, the performance can be better.

Examples:
 * VMWare: ESXi
 * Linux:  Xen

Benefits:

Greater performance and scalability.

Drawbacks:

More complicated to setup.

So since this LQWiki is focused on Xen, that's what will talk about from here on:

High level steps of what we need to get Xen working:
 * 1) Install a Xen kernel
 * 2) Decide whether we want to use Full-Virtualization or Para-Virtualization
 * 3) Configure networking for multiple virtual machines
 * 4) Install a Virtual Machine

1. Install a Xen kernel The easiest way to do this is to install an OS from scratch. Generally installers these days have a an easy way to select all of the xen packages that you would need. I believe both Fedora and OpenSUSE have options to install Xen. I know SLES (SuSE Linux Enterprise Server and Red Hat Enterprise have options to install Xen.

But you may already have an OS that you can't just wipe out. In that case your best bet is is to go though your OS's package management software to try to install Xen.

Xen is a Linux kernel, so you must boot off of the Xen kernel to be able to use it. If you installed the xen kernel after your initial OS, you may or may not be able to boot off of the Xen kernel by default. Hopefully there is an entry in grub, and you can choose to boot off of this kernel if it doesn't boot by default.

2. Decide whether we want to use Full-Virtualization or Para-Virtualization Long story short if you can go Full-Virtualization, this is the route you want to go.

Para-Virtualization: This is sort of a hackerish way of getting a VM to run, specifically on older hardware that does not support the VT-x (Intel), or AMD-V (AMD) extensions.

Use case for Para-Virtualization: In my previous job, we had about 8000 physical servers with a range of different hardware models. About 4000 servers were older and they did not support the VT-x extensions. So for this, we had to go para-virtualized, that way we could use the same virtual machines regardless of the server platform.

Full-Virtualization: The guest Operating System more-or-less looks like a bare-metal install. The term "bare-metal" refers to an installation of a non-virtual OS. So just taking a Linux cd/dvd, and installing it on a computer would be considered a bare-metal install.