XEN/PV full guest install // Ubuntu / Debian / Devuan

This is the classical full disk guest installation flavor. Our prefered method is rather deboostrap, see the other guide.

Requirements

dist=xenial
mirror=ru

Ubuntu,

mkdir -p /data/kernels/ubuntu.$dist/
cd /data/kernels/ubuntu.$dist/
wget http://$mirror.archive.ubuntu.com/ubuntu/dists/$dist/main/installer-amd64/current/images/netboot/xen/vmlinuz
wget http://$mirror.archive.ubuntu.com/ubuntu/dists/$dist/main/installer-amd64/current/images/netboot/xen/initrd.gz

Debian,

mkdir /data/kernels/debian.$dist
cd /data/kernels/debian.$dist
wget http://ftp.ru.debian.org/debian/dists/$dist/main/installer-amd64/current/images/netboot/xen/vmlinuz
wget http://ftp.ru.debian.org/debian/dists/$dist/main/installer-amd64/current/images/netboot/xen/initrd.gz

Devuan,

mkdir /data/kernels/devuan.ascii
cd /data/kernels/devuan.ascii
wget http://auto.mirror.devuan.org/merged/dists/ascii/main/installer-amd64/current/images/netboot/xen/vmlinuz
wget http://auto.mirror.devuan.org/merged/dists/ascii/main/installer-amd64/current/images/netboot/xen/initrd.gz

Virtual Disk

mkdir -p /data/guests/$dist/
cd /data/guests/$dist/

dd if=/dev/zero of=$dist.disk bs=1G count=0 seek=10

Guest Configuration

cat > $dist <<-EOF
kernel = "/data/kernels/17vmlinuz"
ramdisk = "/data/kernels/17initrd.gz"
#root = "/dev/xvda1 ro netcfg/do_not_use_netplan=true"
#kernel = "/usr/local/bin/pygrub"
#kernel = "/usr/lib/xen-4.9/bin/pygrub"
memory = 1024
name = "$dist"
vcpus = 4
disk = [ 'tap:aio:/data/guests/$dist/$dist.disk,xvda,w' ]
vif = [ 'bridge=xenbr0, vifname=$dist.0' ]
EOF

Ready to go

xl create $dist -c

Guest System Installation

Provide the right repo on your network as described in the PXEing Ubuntu guide, and use it as a proxy right after defining your nearest official mirror,

proxy URL: http://x.x.x.x:3142

server mode install options e.g.,

install security updates auto
openssh
basic ubuntu server

back to the guest setup (once rebooted after successful installation),

xl destroy $dist
cd /data/guests/$dist/
vi $dist

kernel = "/data/kernels/1710vmlinuz"
#ramdisk = "/data/kernels/1710initrd.gz"
root = "/dev/xvda1 ro netcfg/do_not_use_netplan=true"

xl create $dist -c

Ref. https://help.ubuntu.com/community/Xen