Debian and Ubuntu are some of the most stable Linux distributions out there. This is because the packages that are part of the official repositories are frozen and tested many times by many people. However, this brings a consequence: that we will not be able to have the most recent versions of the programs. An example of this is MariaDB which is a vital program for many people. So, today I will show you how to install MariaDB 10.4 on Debian 10.
MariaDB is a well-known archi Database Relationships Management System that is a MySQL fork. This is due to the purchase of Sun Mycrosystem by Oracle. It is perfectly compatible with MySQL and is available in most Linux distributions.
In Debian 10 the version of MariaDB that is available in the official repositories is 10.3, but recently has seen the release of version 10.4 with some interesting new features. Some of them are:
- The unix_socket authentication plugin is now default on Unix-like systems. This represents a considerable improvement in authentication security.
- The obsolete mysql.host table is no longer created
- User password expiry. This forces you to change it periodically.
- User accounts and global privileges are now stored in the mysql.global_priv table.
And many other news related to the creation of cLuster and Galera 4. If you want to know them, I recommend you to read the changes and improvements of version 10.4.
So, let us start.
Getting MariaDB 10.4 on Debian 10
It is always a good idea to have a program as critical as MariaDB updated. So let’s go for it.
Open a terminal or connect to your server using SSH.
Then, install some packages needed to accomplish the goal.
:~$ sudo apt-get install software-properties-common dirmngr Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: gir1.2-packagekitglib-1.0 gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm libappstream4 libassuan0 libglib2.0-bin libgstreamer1.0-0 libksba8 libnpth0 libpackagekit-glib2-18 libstemmer0d packagekit packagekit-tools pinentry-curses python3-distro-info python3-software-properties unattended-upgrades Suggested packages: pinentry-gnome3 tor parcimonie xloadimage scdaemon gstreamer1.0-tools appstream pinentry-doc bsd-mailx default-mta | mail-transport-agent needrestart The following NEW packages will be installed: dirmngr gir1.2-packagekitglib-1.0 gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm libappstream4 libassuan0 libglib2.0-bin libgstreamer1.0-0 libksba8 libnpth0 libpackagekit-glib2-18 libstemmer0d packagekit packagekit-tools pinentry-curses python3-distro-info python3-software-properties software-properties-common unattended-upgrades 0 upgraded, 26 newly installed, 0 to remove and 0 not upgraded. Need to get 10.5 MB of archives. After this operation, 25.6 MB of additional disk space will be used. Do you want to continue? [Y/n]
These packages are needed to add a special MariaDB repository for Debian 10.
The next step is to download the file containing the GPG key from the MariaDB repository for Debian 10.
:~$ wget https://mariadb.org/mariadb_release_signing_key.asc --2020-02-06 19:24:09-- https://mariadb.org/mariadb_release_signing_key.asc Resolving mariadb.org (mariadb.org)... 178.63.77.61, 195.201.174.49, 2a01:4f8:13a:164e::2, ... Connecting to mariadb.org (mariadb.org)|178.63.77.61|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 6575 (6.4K) [application/octet-stream] Saving to: 'mariadb_release_signing_key.asc' mariadb_release_signing_key.asc 100%[=====================================================================================>] 6.42K --.-KB/s in 0s 2020-02-06 19:24:12 (65.7 MB/s) - 'mariadb_release_signing_key.asc' saved [6575/6575]
And the add the key to the system.
:~$ sudo apt-key add mariadb_release_signing_key.asc OK
Then, add the MariaDB repository to the system’s source list. You do this with this command:
:~$ sudo add-apt-repository 'deb [arch=amd64] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.4/debian buster main'
In this example, I am using a mirror located in the USA. In this link you can get other mirrors.
To use the repository, you have to refresh the APT sources.
:~$ sudo apt update
And finally install MariaDB 10.4 on Debian 10 with the following command:
:~$ sudo apt install mariadb-server Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: galera-4 gawk libaio1 libcgi-fast-perl libcgi-pm-perl libdbd-mysql-perl libdbi-perl libencode-locale-perl libfcgi-perl libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl libmpfr6 libreadline5 libsigsegv2 libterm-readkey-perl libtimedate-perl liburi-perl mariadb-client-10.4 mariadb-client-core-10.4 mariadb-common mariadb-server-10.4 mariadb-server-core-10.4 psmisc rsync socat Suggested packages: gawk-doc libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl libdata-dump-perl libipc-sharedcache-perl libwww-perl mailx mariadb-test netcat-openbsd tinyca The following NEW packages will be installed: galera-4 gawk libaio1 libcgi-fast-perl libcgi-pm-perl libdbd-mysql-perl libdbi-perl libencode-locale-perl libfcgi-perl libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl libmpfr6 libreadline5 libsigsegv2 libterm-readkey-perl libtimedate-perl liburi-perl mariadb-client-10.4 mariadb-client-core-10.4 mariadb-server mariadb-server-10.4 mariadb-server-core-10.4 psmisc rsync socat The following packages will be upgraded: mariadb-common 1 upgraded, 30 newly installed, 0 to remove and 11 not upgraded. Need to get 29.1 MB of archives. After this operation, 217 MB of additional disk space will be used. Do you want to continue? [Y/n]
If you have MariaDB installed, just upgrade the system.
:~$ sudo apt upgrade
Now that it is installed, define a root password thanks to the mysql_secure_installation script.
:~$ sudo mysql_secure_installation
When you run it, you will be asked several questions that you have to answer according to your needs:
Remove anonymous users? Y Disallow root login remotely? Y Remove test database and access to it? Y Reload privilege tables now? Y
Finally, chek the installed version.
:~$ mysql --version
So, that is it.
Conclusion
Having the programs updated gives us an incredible feeling of security. This is because these programs with each version improve their stability and incorporate new features that we can take advantage of without problems.
Please share this post and join our Telegram channel.