In April 2023, the Linux long term support (LTS) of Ubuntu 18.04 (Bionic) ended. At the same time, support for MariaDB 10.3 ended a couple of weeks ago (in May 2023). In case you were running MariaDB 10.3 on a Ubuntu 18.04, here are some notes on how to properly run an upgrade of both.
Note: If you run a Galera cluster and have proper application balancing to the database nodes, you can even do this without application downtime.
Upgrading OS or MariaDB? Taking a backup or a machine snapshot prior to such tasks shouldn't even be mentioned here - it should be common sense. So don't risk it, just do a backup of the databases, take a machine snapshot, etc.
As MariaDB 10.3 is meanwhile end of life, the oldest available release on the MariaDB package repositories is currently 10.4. Time to upgrade MariaDB 10.3 to 10.4 by adding the new repository key and the new repository:
root@mariadb:~# apt-get install apt-transport-https curl
root@mariadb:~# mkdir -p /etc/apt/keyrings
root@mariadb:~# curl -o /etc/apt/keyrings/mariadb-keyring.pgp 'https://mariadb.org/mariadb_release_signing_key.pgp'
root@mariadb:~# vi /etc/apt/sources.list.d/mariadb.list
root@mariadb:~# cat /etc/apt/sources.list.d/mariadb.list
deb [signed-by=/etc/apt/keyrings/mariadb-keyring.pgp] https://mirror.mva-n.net/mariadb/repo/10.4/ubuntu bionic main
Note: Obviously replace the mirror URL with your own preferred mirror.
Then stop MariaDB and launch the upgrade:
root@mariadb:~# systemctl stop mariadb
root@mariadb:~# apt-get update
root@mariadb:~# apt-get dist-upgrade
Make sure the output shows that the mariadb packages will be upgraded. If that's not the case, you need to select the new packages manually for the installation:
root@mariadb:~# apt-get install galera-4 mariadb-server-10.4
After the upgrade has completed successfully, start MariaDB again:root@mariadb:~# systemctl start mariadb
Now that we're having MariaDB 10.4 installed, which is also available in the MariaDB repositories for "focal", we can upgrade Ubuntu from bionic to focal. I personally do this the old-fashioned way, by replacing the release name in the APT repository lists and running a dist-upgrade:
root@mariadb:~# cp /etc/apt/sources.list{,.bionic}
root@mariadb:~# sed -i "s/bionic/focal/g" /etc/apt/sources.list
root@mariadb:~# sed -i "s/bionic/focal/g" /etc/apt/sources.list.d/mariadb.list
root@mariadb:~# apt-get update
root@mariadb:~# apt-get dist-upgrade
Once the dist-upgrade has completed, your machine will be on Ubuntu 20.04 LTS and continues to run MariaDB 10.4. You should finish and verify the Ubuntu upgrade with a reboot.
Next up is another MariaDB upgrade to an intermediate version 10.5.
To upgrade MariaDB from 10.4, basically replace 10.4 by 10.5 in the existing MariaDB repository file:root@mariadb:~# cat /etc/apt/sources.list.d/mariadb.list
deb [signed-by=/etc/apt/keyrings/mariadb-keyring.pgp] https://mirror.mva-n.net/mariadb/repo/10.5/ubuntu bionic main
Then stop MariaDB and launch the upgrade:
root@mariadb:~# systemctl stop mariadb
root@mariadb:~# apt-get update
root@mariadb:~# apt-get dist-upgrade
Also important at that point is to realize that, in case you've had MySQL config files (ending in .cnf) in /etc/mysql/conf.d/, they will be ignored starting with MariaDB 10.5. These (manually created) config files should be placed into /etc/mysql/mariadb.conf.d/ now. Here's an example:
root@mariadb:~# mv /etc/mysql/conf.d/mariadb.cnf /etc/mysql/mariadb.conf.d/98-mariadb.cnf
root@mariadb:~# mv /etc/mysql/conf.d/galera.cnf /etc/mysql/mariadb.conf.d/99-galera.cnf
After the upgrade has completed successfully and you've moved your own cnf files, start MariaDB again:
root@mariadb:~# systemctl start mariadb
Now we're already at the last step, at least for MariaDB. 10.6 is a MariaDB LTS version and offers support until July 2026.
There are a couple of removed config options which should be removed from any local cnf config files. One option in particular could be used on quite a lot of MariaDB installations: innodb_buffer_pool_instances. This option is often recommended to be changed by the mysqltuner command. Before running the upgrade make sure to not use any removed config options anymore.
Once verified, change the MariaDB version in the apt repository to 10.6:
root@mariadb:~# cat /etc/apt/sources.list.d/mariadb.list
deb [signed-by=/etc/apt/keyrings/mariadb-keyring.pgp] https://mirror.mva-n.net/mariadb/repo/10.6/ubuntu bionic main
Then stop MariaDB and launch the upgrade:
root@mariadb:~# systemctl stop mariadb
root@mariadb:~# apt-get update
root@mariadb:~# apt-get dist-upgrade
After the upgrade has completed successfully, start MariaDB again:
root@mariadb:~# systemctl start mariadb
With MariaDB 10.6 installed, we're good for the next couple of years (unless you want to go use newer versions of course). Time for the final step: Upgrading the Ubuntu release to the currently newest LTS version: 22.04 (Jammy).
Same as before, replace the focal release name by jammy in the APT repositories, followed by the dist-upgrade:
root@mariadb:~# cp /etc/apt/sources.list{,.focal}
root@mariadb:~# sed -i "s/focal/jammy/g" /etc/apt/sources.list
root@mariadb:~# sed -i "s/focal/jammy/g" /etc/apt/sources.list.d/mariadb.list
root@mariadb:~# apt-get update
root@mariadb:~# apt-get dist-upgrade
Once the dist-upgrade has completed, your machine will be on Ubuntu 22.04 LTS and continues to run MariaDB 10.6 LTS. You should finish and verify the Ubuntu upgrade with a reboot.
No comments yet.
AWS Android Ansible Apache Apple Atlassian BSD Backup Bash Bluecoat CMS Chef Cloud Coding Consul Containers CouchDB DB DNS Database Databases Docker ELK Elasticsearch Filebeat FreeBSD Galera Git GlusterFS Grafana Graphics HAProxy HTML Hacks Hardware Icinga Influx Internet Java KVM Kibana Kodi Kubernetes LVM LXC Linux Logstash Mac Macintosh Mail MariaDB Minio MongoDB Monitoring Multimedia MySQL NFS Nagios Network Nginx OSSEC OTRS Observability Office OpenSearch PGSQL PHP Perl Personal PostgreSQL Postgres PowerDNS Proxmox Proxy Python Rancher Rant Redis Roundcube SSL Samba Seafile Security Shell SmartOS Solaris Surveillance Systemd TLS Tomcat Ubuntu Unix VMWare VMware Varnish Virtualization Windows Wireless Wordpress Wyse ZFS Zoneminder