don't do this at home!. This runs kernel 5.0.0 on Azure VM. The version itself is not certified yet to run on Azure.
Create VM on Azure follow https://docs.microsoft.com/en-us/azure/virtual-machines/linux/quick-create-cli
ssh to your new machine
apt install -y build-essential flex bison libssl-dev libelf-dev
wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.0.tar.xz
xz -v -d linux-5.0.tar.xz
tar xvf linux-5.0.tar
No signture verification, You should be checking it.
cd linux-5.0
cp -v /boot/config-$(uname -r) .config
# prep using existing kernel config
make olddefconfig
make prepare
make #-j $(nproc) if you decided to go with multicore VM
make modules_install
sudo make install
update-initramfs -ck 5.0.0
sudo update-grub
shutdown -r now
# after boot
uname -r
You reminded me of the Debian way of doing this, which on Azure I roughly summarize like this (tried using a Debian 10 daily image, but I guess an Ubuntu image would be useful too for the
-azureconfig)From here you can take two routes. The naive Debian way:
Or the pure Debian way:
Sometimes I also get asked how to build a kernel from a different source package (i.e., not from latest upstream, since those are seldom in source package format)
For example, if you wanted to build this kernel or the linux-azure from Ubuntu you would:
Either way you can
sudo dpkg -ithe debs andsudo systemctl reboot. The advantage is that you don't need to mess with GRUB or the initrds, and it's easier to rollback or even fast forward to the distro-maintained version of the kernel (when available) using standard package management operations.