Boot the Ubuntu installation medium. When asked, choose the "Try Ubuntu" option and open a terminal.
Switch to root, otherwise you'll have to type sudo
all the time:
sudo su -
Enable the universe
repository and install required tools:
add-apt-repository universe
apt update
apt install debootstrap arch-install-scripts
Create image partition.
lvcreate -L 10G -n noble vg_xen
Create the filesystems:
mkfs.ext4 /dev/vg_xen/noble
Install base system using debootstrap
. Since I'm installing 24.04, use the noble
identifier. You can also specify your mirror, choose one that is faster/closer to you:
debootstrap noble /mnt
The mirror will also be written to sources.list
, so choose an actually good one. If you don't specify one, the default is the main repository located in US.
Edit /mnt/etc/apt/sources.list
, add -security
, -updates
and -backports
suites, as well as restricted
and universe
repositories:
deb http://archive.ubuntu.com/ubuntu noble main restricted universe
deb http://archive.ubuntu.com/ubuntu noble-security main restricted universe
deb http://archive.ubuntu.com/ubuntu noble-updates main restricted universe
deb http://archive.ubuntu.com/ubuntu noble-backports main restricted universe
Chroot into the installation environment:
arch-chroot /mnt
Update and add more necessary packages:
apt update
apt upgrade
apt install --no-install-recommends linux-{,image-,headers-}generic linux-firmware initramfs-tools
This is also where you pick your kernel. I'm using GA kernel. Now install a text editor:
apt install nano
Configure your timezone, locales and keyboard layout. I use Europe/Helsinki
timezone and en_US.UTF-8 locales, and a standard FI keyboard:
dpkg-reconfigure tzdata
dpkg-reconfigure locales
dpkg-reconfigure keyboard-configuration
Set your hostname:
echo "noble" > /etc/hostname
echo "127.0.0.1 noble" >> /etc/hosts
We need fstab also
nano /etc/fstab
Example how it could be.
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/xvda1 / ext4 rw,relatime 0 1
Create your sudo user and set a password for it:
useradd -mG sudo your-user -s /bin/bash
passwd your-user
For most single ethernet cable setups, you can just create a configuration in /etc/netplan/01-interfaces.yaml
:
network:
version: 2
renderer: networkd
ethernets:
enX0:
dhcp4: true
Replace enX0
with your interface name, find it out using ip a
.
You can install other useful packages that you need, here's what I install:
apt install at curl dmidecode ethtool gawk git gnupg htop man \
openssh-server patch screen software-properties-common tmux zstd \
bash-completion file command-not-found
Finally, install a bootloader of your choice. I will install GRUB:
apt install grub-pc
update-grub
If you hypervisor is older and thus not support ZSTD compression, then decompress the kernel image.
wget -O /usr/local/sbin/extract-vmlinux https://raw.githubusercontent.com/torvalds/linux/master/scripts/extract-vmlinux
chmod +x /usr/local/sbin/extract-vmlinux
wget -O /etc/kernel/postinst.d/decompress-kernels https://gist.githubusercontent.com/Floppe/700de5ffe6cf0842d66322873c83791a/raw/a706f42c7c01020170beb2cdac47528179c8e6aa/decompress_kernel
chmod +x /etc/kernel/postinst.d/decompress-kernels
apt install lz4 binutils
And reinstall the kernel so post hook decompresses the kernel
apt reinstall linux-image-6.8.0-31-generic
Unmount and setup as guest. Boot it up and get the IP, then SSH into the new guest.
Install your keys
ssh-add -L >> .ssh/authorized_keys
chmod 600 .ssh/authorized_keys
I like to see the boot logs, so remove quite splash from /etc/default/grub
update-grub
Get system information when logging.
apt install update-notifier-common landscape-common