MariaDB 10.11 Installation - Debian 11 (bullseye)

This article describes how to install MariaDB 10.11 on Debian 11 (bullseye).


This article uses an official MariaDB mirror (mirror.creoline.net). https://mirmon.mariadb.org/#de



Preparation

To install MariaDB, the local repositories are first updated.


apt-get update && apt-get dist-upgrade



Add APT repository

The official Debian repositories currently contain the MariaDB server package in version 10.5 under Debian 11. To be able to use the current version of MariaDB, an additional APT repository must be installed.


# Create a new source list
echo "deb [arch=amd64] https://mirror.creoline.net/mariadb/repo/10.11/debian bullseye main" | tee /etc/apt/sources.list.d/mariadb.list

# Add the public key
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 F1656F24C74CD1D8

# Update APT repositories
apt-get update


Show MariaDB 10.11 server information

Before starting the installation, you can use apt info to check which package will actually be installed.


apt info mariadb-server
Package: mariadb-server
Version: 1:10.11.1+maria~deb11 <-------
Priority: optional
Section: database
Source: mariadb-10.11
Maintainer: MariaDB Developers <maria-developers@lists.launchpad.net>
Installed-Size: 10,2 kB
Depends: mariadb-server-10.8 (>= 1:10.8.4+maria~deb11)
Homepage: https://mariadb.org/
Download-Size: 2.832 B

APT-Sources: https://mirror.creoline.net/mariadb/repo/10.8/debian bullseye/main amd64 Packages

Description: MariaDB database server (metapackage depending on the latest version) [...]


The installation of the MariaDB server can then be executed:


apt-get install mariadb-server


Package lists are read... Done
Dependency tree is built... Done
Status information is read in... Done
The following additional packages are installed:
  galera-4 gawk libcgi-fast-perl libcgi-pm-perl libclone-perl libconfig-inifiles-perl libdaxctl1
  libdbd-mariadb-perl libdbi-perl libdbi-perl libfcgi-locale-perl libfcgi-bin libfcgi-perl libfcgi0ldbl
  libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl
  libio-html-perl liblwp-mediatypes-perl libmariadb3 libmpfr6 libndctl6 libpmem1 libsigsegv2
  libterm-readkey-perl libtimedate-perl liburi-perl mariadb-client-10.8 mariadb-client-core-10.8
  mariadb-common mariadb-server-10.8 mariadb-server-core-10.8 mysql-common psmisc rsync socat
Suggested packages:
  gawk-doc libmldbm-perl libnet-daemon-perl libsql-statement-perl libdata-dump-perl
  libipc-sharedcache-perl libwww-perl mailx mariadb-test netcat-openbsd
The following NEW packages are installed:
  galera-4 gawk libcgi-fast-perl libcgi-pm-perl libclone-perl libconfig-inifiles-perl libdaxctl1
  libdbd-mariadb-perl libdbi-perl libdbi-perl libfcgi-locale-perl libfcgi-bin libfcgi-perl libfcgi0ldbl
  libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl
  libio-html-perl liblwp-mediatypes-perl libmariadb3 libmpfr6 libndctl6 libpmem1 libsigsegv2
  libterm-readkey-perl libtimedate-perl liburi-perl mariadb-client-10.8 mariadb-client-core-10.8
  mariadb-common mariadb-server mariadb-server-10.8 mariadb-server-core-10.8 mysql-common psmisc rsync
  socat
0 updated, 38 reinstalled, 0 to be removed and 0 not updated.
31.3 MB of archives need to be downloaded.
After this operation, an additional 225 MB of disk space will be used.
Would you like to continue? [Y/n]


The installation can be confirmed with the Enter, Y or Y button.


After installation, the automatic systemd status can be checked when the server is started using the following command:


systemctl is-enabled mariadb
enabled


The current service status can also be displayed using systemctl status mariadb:


root@db02:/# systemctl status mariadb

● mariadb.service - MariaDB 10.11.1 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/mariadb.service.d
             └─migrated-from-my.cnf-settings.conf
     Active: active (running) since Thu 2022-09-01 13:24:05 CEST; 3min 8s ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 3280 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
    Process: 3281 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 3283 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [>
    Process: 3329 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 3331 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
   Main PID: 3312 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 9 (limit: 4678)
     Memory: 207.7M
        CPU: 514ms
     CGroup: /system.slice/mariadb.service
             └─3312 /usr/sbin/mariadbd




Secure MariaDB server

After MariaDB has been successfully installed, the anonymous MySQL user can be removed using mysql_secure_installation. In addition, secure socket authentication can be activated.


mysql_secure_installation


Setting Default Description
Switch to unix_socket authentication [Y/n] Unix Socket Authentication maps the Unix-based login for root@localhost.
Change the root password? [Y/n] Change the MySQL root user password
Remove anonymous users? [Y/n] Remove all anonymous users
Disallow root login remotely? [Y/n] Disables the remote login as root user. (Remote means not equal to @localhost | 127.0.0.1)
Remove test database and access to it? [Y/n] Remove all test databases and privileges
Reload privilege tables now? [Y/n] Reload all privileges




Common problems with the MariaDB installation


Missing SSH key for repository signing

Error message: NO_PUBKEY F1656F24C74CD1D8


Complete error message:

root@mariadb:/etc/apt/sources.list.d# apt update

OK:1 https://mirror.creoline.net/debian bullseye InRelease
OK:2 https://mirror.creoline.net/debian-security bullseye-security InRelease
OK:3 https://mirror.creoline.net/debian bullseye-updates InRelease

Get:4 https://mirror.creoline.net/mariadb/repo/10.8/debian bullseye InRelease [4.637 B]
Failed:4 https://mirror.creoline.net/mariadb/repo/10.8/debian bullseye InRelease
The following signatures could not be verified because their public key
is not available: NO_PUBKEY F1656F24C74CD1D8
Package lists are being read... Done

W: GPG error: https://mirror.creoline.net/mariadb/repo/10.8/debian bullseye InRelease:
The following signatures could not be verified because their public key
is not available: NO_PUBKEY F1656F24C74CD1D8

E: The depot "https://mirror.creoline.net/mariadb/repo/10.8/debian bullseye InRelease" is
not signed.

N: An update of such a depot cannot be carried out in a secure way, so it is deactivated by default.
therefore it is deactivated by default.
N: Further details on the creation of package repositories and their user configuration
can be found in the manual page apt-secure(8).


Solution:

Add the public key to your local GPG client.


apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 F1656F24C74CD1D8
gpg: Key F1656F24C74CD1D8:
Public key "MariaDB Signing Key <signing-key@mariadb.org>" imported

gpg: Total number of keys processed: 1
gpg: imported: 1