# Prerequisites

For this little how-to I assume that you have Xen Cloud Platform (XCP) already installed and successfully configured. The first things to do will be

• creating and / or joining a resource pool,
• creating and attaching a storage repository and
• configuring the network (e.g. with bonding).

I will not describe how to do this here, as it really depends on your configuration. You can look for further help here. Even if these documents are really outdated (XCP v0.1), most information is still accurate and useful.

You just have to ignore some special things which have been taken over from Citrix XenServer (e.g. installing Linux Tools is absolutely not necessary as you will also see here). Another thing that should be working already is a connection to the Dom0 console however you prefer it.

Access Local Command Shell via xsconsole on Xen Cloud Platform 1.1

If you are accessing xsconsole directly, you can choose "Local Command Shell". The recommended way would be using ssh and this is also what I do. First of all you have to choose which guest (DomU) operating system you would like to install.

In general there are two possible ways of installing VMs on XCP:

• Installing Windows VMs
• Installing Linux VMs

There are a few differences in installing Windows guests in comparison to Linux VMs. I will not describe how to install Windows guests but you can find all necessary information here.

# Installing Linux VMs

Still there is another decision to make:

1. Installing with templates
2. Installing from vendor media

Do a xe template-list | less to scroll through the available templates. If you can find a template for the distribution you would like to install, you should go on with step 1.

It is not absolutely necessary to use templates, so if you want to install the most recent version of some Linux distribution where there is no template available yet, this is also possible. It is just more comfortable with templates. Still I'm not going to describe how to install a guest from vendor media, so please see here for a step-by-step guide.

# 1. Installing with templates

I'm going to install the most current Ubuntu Long Term Support (LTS) version which is 10.04 Lucid Lynx in 64-bit mode. Don't worry about the (experimental) in the template name, it does work very well.

So now you can install your VM with the following command:

xe vm-install template=[Your\ desired\ OS] new-name-label=[NameOfYourVM]

You can always use tab to automatically finish one command, so you don't have to type the whole name of the template. This will give you the UUID of the created VM:

9ecea6e2-6964-b944-e909-65a23b819ce7

Next you should check all parameters of your VM:

xe vm-list uuid=9ecea6e2-6964-b944-e909-65a23b819ce7 params=all

Again use tab to write the UUID automatically. What I'm actually interested in are the memory settings:

uuid ( RO)                          : 9ecea6e2-6964-b944-e909-65a23b819ce7
name-label ( RW): sugar
name-description ( RW): Installed via xe CLI
user-version ( RW): 1
[...]
memory-actual ( RO): 0
memory-target ( RO):
memory-static-max ( RW): 268435456
memory-dynamic-max ( RW): 268435456
memory-dynamic-min ( RW): 268435456
memory-static-min ( RW): 134217728
[...]
protection-policy ( RW):
is-snapshot-from-vmpp ( RO): false
tags (SRW):

These are only 268MB of RAM for this VM, so the installation will be very slow. Therefor we should change this by using a great Xen functionality called Dynamic Memory Control (DMC).

There are two modes available:

• Target Mode and
• Dynamic Range Mode.

Please read this FAQ about what to use and how. I've decided to use Target Mode. But first you have to change the static and dynamic max and min values to something more appropriate (otherwise you won't be able to set a memory-target).

So here is how it works:

xe vm-param-set uuid=9ecea6e2-6964-b944-e909-65a23b819ce7 memory-static-max=[SMa]

xe vm-param-set uuid=9ecea6e2-6964-b944-e909-65a23b819ce7 memory-dynamic-max=[DMa]

xe vm-param-set uuid=9ecea6e2-6964-b944-e909-65a23b819ce7 memory-dynamic-min=[DMi]

xe vm-param-set uuid=9ecea6e2-6964-b944-e909-65a23b819ce7 memory-static-min=[SMi]

The formula for these values is $SMi \le DMi \le DMa \le SMa$. What to choose for each of them is very up to you. Here is just a little recommendation from me but you really don't have to do this:

As $SMa$ can be the largest value, you could set it to your actual amount of RAM. But please consider that there is also Dom0 which needs some of this memory. So I have 4GB of RAM in my old servers, therefor I set $SMa$ to 3.5GB or $SMa = 3500000000$.

$SMi$ depends on how much RAM you have in your servers and how many VMs you are planning to execute on them. As I am very limited with 4GB I set $SMi = 512000000$ and $DMi = SMi$ and $DMa = SMa$. Finally you can set your memory-target:

xe vm-memory-target-set uuid=9ecea6e2-6964-b944-e909-65a23b819ce7 target=[memory-target]

This will be most likely the same value as $DMa$.

Now you have a last choice to make:

1. Install from Install Repository
2. Install from vendor media

As I'm using a template I will also use the default way of installation via an install repository. Even if you are using templates you could still install from vendor media, e.g if you only have a slow or even no Internet connection at all. Again, I will not describe how to do this here as you can find it in the Xen Cloud Platform Virtual Machine Installation Guide.

### 1.1 Install from Install Repository

First of all you have to find out the URL of your desired distribution install repository. You will have to search a bit to figure this out. For Ubuntu you can find it on http://archive.ubuntu.com/ubuntu.

It is recommended to use a mirror near to your location, so add your country code before archive. For Austria this is http://at.archive.ubuntu.com/ubuntu. Now set this repository for your created VM:

xe vm-param-set uuid=9ecea6e2-6964-b944-e909-65a23b819ce7 other-config:install-repository=http://at.archive.ubuntu.com/ubuntu/

Next you will have to assign a virtual network interface (VIF) for your VM. So check your available networks first:

xe network-list

Depending on how many network interface cards (NICs) you have in your servers this will show you different amounts of Xen bridges (xenbr). I will use the one from eth0 for my VM now:

uuid ( RO)                : edf3408d-29b6-51de-252d-c28031363a7b
name-label ( RW): Host internal management network
name-description ( RW): Network on which guests will get assigned a private link-local IP address
[...]
uuid ( RO)                : baf6dd81-6550-7446-b57f-dfe633759b33
name-label ( RW): Pool-wide network associated with eth0
name-description ( RW):
bridge ( RO): xenbr0
[...]
name-label ( RW): Host internal management network
name-description ( RW): Network on which guests will get assigned a private link-local IP address
bridge ( RO): xapi1

So this means xenbr0 for me:

xe network-list bridge=xenbr0 --minimal

This will give me the UUID only:

baf6dd81-6550-7446-b57f-dfe633759b33

At last we can create the VIF:

xe vif-create vm-uuid=9ecea6e2-6964-b944-e909-65a23b819ce7 network-uuid=baf6dd81-6550-7446-b57f-dfe633759b33 mac=random device=0

This will again show you the UUID of the newly created VIF:

348f8790-0f9b-bbe5-abd2-f4d86cf26fd7

Finally, we can start the VM with the following command:

xe vm-start uuid=9ecea6e2-6964-b944-e909-65a23b819ce7

This will take a few seconds and if there are no errors, it means that it worked and the VM is running. Now the last thing to do is to follow the installation and do some configuration steps inside the OS. Therefor you would have to access the console.

Actually this is provided by Virtual Network Computing (VNC) so you would only need to connect with a VNC viewer. Unfortunately this is quite circumstantial and not that easy to handle. So I would recommend you to use a graphical software for this.

If you are working on Windows you could use XenCenter which is provided by Citrix for free, even if it is not open source. Alternatively you could try OpenXenManager which is open source but in my experience not working very well on Windows.

Ubuntu 10.04 Desktop VM in Oracle VM VirtualBox on Windows Vista

If you are running Linux then this may be your first choice. I have an Oracle VM running on my Windows PC with Ubuntu 10.04 Desktop and have OpenXenManager installed on this.

Xen VNC console in OpenXenManager on Linux Ubuntu