A Virtual Private Server (VPS) contains multiple software based servers on a single hardware server. Each of the virtual servers has its own operating system appears to run on its own dedicated machine. In this article we will create a VPS using the Xen hypervisor and Ubuntu.
To create a VPS, you must first have a hypervisor, or virtual machine monitor (VMM). There are two types of hypervisors. Type 1 (bare-metal) hypervisors run directly on top of the hardware whereas Type 2 (hosted) hypervisors are software based.
Xen is a Type 1 hypervisor. It is structured into three layers. The Xen layer is the lowest level, which resides directly on top of the hardware. The second layer is the domain 0 (dom0) layer which is the first operating system to boot when the server is turned on. This is the layer that has direct access to the physical hardware. It is also the layer that the system administrator uses to manage the remaining guest operating systems. The third layer is the domain U (domU) layer which is all of the guest operating systems except for the dom0 OS.
Creating the Dom0
Sample contents.The scope of this article only covers creating the dom0 layer. Even though the Xen layer resides over the hardware layer, you will have to start with a server running Ubuntu 9.04 server edition. You will need to download the Debian Xen kernel and modules from the Debian website. Install the kernel and modules with the command:
sudo dpkg -i linux-image-2.6.26-2-xen-686_2.6.26-15lenny2_i386.deb linux-modules-2.6.26-2-xen-686_2.6.26-15lenny2_i386.deb
Once the kernel is installed, the next step is to download the Xen hypervisor and tools with the command:
sudo apt-get install xen-docs-3.3 xen-hypervisor-3.3 xen-utils-3.3 xen-tools
That is all the software that will need to be installed. The dom0 is created with the command:
sudo xen-create-image --hostname=example.net --ip=192.168.0.235 --ide --force --dir /xen
It is then started with the command:
sudo xm create /etc/xen/example.net.cfg
That is all that is needed to create the Xen layer and the first guest operating system. From here you can create as many guest operating systems as your hardware will support.