On a new install go to the latest version

I start by upgrading Ubuntu to latest and greatest.

sudo apt update
sudo apt list --upgradable -a
sudo apt dist-upgrade
sudo reboot

 

You start by stopping mariadb and removing it.

sudo systemctl stop mariadb

sudo apt remove mariadb-server

Next you setup the new repository

sudo apt-get install software-properties-common
sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc' 
sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu focal main'



sudo apt update
sudo apt install mariadb-server

Then I run the upgrade commands again to get any patches

sudo apt update
sudo apt list --upgradable -a
sudo apt dist-upgrade