Create a Debian domU from a cloud image

On Xen/InstallDebianGuest, a manual install is needed in the virtual machine, which may prove time consuming for quick tests. So this time let's use "cloning", taking a cloud image as the base.
Most steps are common between the two methods, and using those images means "you know what you are doing", so it will be less exhaustive. Refer to the other guide for a bit more information !

WIP - Parts of the guide are untested.

The Debian cloud images

The Debian cloud images are small and pre-installed, tailored to run as virtual machines. This is a perfect "base" for servers or small installs.
On a self-hosted Xen, two images are of interest :

The main difference between the two is that the "genericcloud" images do not provide any drivers for physical hardware. So, as of the time of writing, the Xen drivers are not included !

The Debian cloud images are provided by the "Debian Cloud team".

Steps

Create a disk from the cloud image

First, download the image you want to install, links are above.
Then, create a virtual hard disk like that :

qemu-img create -F qcow2 -b <debian cloud base> -f qcow2 <filename> <size>

Examples

qemu-img create -F qcow2 -b debian-12-generic-amd64.qcow2 -f qcow2 disk-deb12-cloud-u1.qcow2 4G
qemu-img create -F qcow2 -b debian-12-generic-amd64.qcow2 -f raw disk-deb12-cloud-u2.raw 4G

The partitions and root filesystem will automatically be resized on boot.

For security reasons, you MUST provide both input and output formats.
Read Xen Security Advisory 48

Create a domU config file

This deb12-cloud-u1.cfg example has no graphics (no vGPU) and must be controlled via serial. If you prefer using VNC/SPICE for the initial config, just copy the DISPLAY part of the example in Xen/InstallDebianGuest.

## NAME - TYPE
name = 'deb12-cloud1'
# type of guest - here Hardware Virtual Machine
type = 'hvm'

## CPU - RAM
vcpus = 2
memory = 2048

## DISKs
disk = [
        '/vm/deb12-cloud-u1/disk-deb12-cloud-u1.qcow2,,xvda' ,
        '/vm/deb12-cloud-u1/disk-swap.img,,xvdb' ,
]

## NETWORK
# if you don't set a MAC address for a vif, xl will set a new one each boot,
# so adjust your guest network config accordingly
vif = [
        'bridge=br-cloud0,mac=00:16:3e:cl:00:d0,vifname=deb-cloud0'
]

## BOOT ORDER
boot = 'c'

## NO vGPU
vga = 'none'

## SERIAL CONSOLE
# this is the emulated one, if omitted you still get a PV one by default
serial = 'pty'

Boot and configure

Finally, start your domain and connect to the serial console immediately

xl create -c deb12-cloud-u1.cfg

If you used the sample config file, you will have no graphics, so -c is used to connect to the serial console automatically on domain creation. The serial console is provided as a PV or emulated one, depending on your config file.

If you forget -c when booting, or want to connect to the console later, use

xl console <Domain>

Whatever method of connection you chose, serial or graphical, you will end up with a pre-installed Debian. \o/
Now, you may want to configure the guest networking and its SSH server for easier remote access.


CategoryXen CategoryVirtualization