Installing MariaDB on Debian, Ubuntu, and Linux Mint
The procedure to install MariaDB on Debian GNU/Linux, Ubuntu, and Linux Mint is easy and starts with a visit to the repository configuration tool from:
https://downloads.mariadb.org/mariadb/repositories
This tool is used for APT-based Linux distributions, such as Debian, Ubuntu, and Mint; Yum-based Linux distributions, such as Fedora, CentOS, and Red Hat; and other distributions that have support for MariaDB built-in, such as Mageia, Arch Linux, Suse, openSUSE, and others.
Tip
Many Linux distributions offer MariaDB in their repositories either as the default MySQL-compatible database or as an alternative choice. The instructions here will install MariaDB directly from the MariaDB repositories instead of from your Linux distribution's repositories.
Before using the tool, we need to know which version of Ubuntu, Debian, or Mint we are currently using. If you do not know, an easy way to find out is with the following command:
cat /etc/lsb-release
The output will be similar to the following:
DISTRIB_ID=Ubuntu DISTRIB_RELEASE=14.04 DISTRIB_CODENAME=trusty DISTRIB_DESCRIPTION="Ubuntu 14.04.1 LTS"
This example output shows that the computer is running Ubuntu 14.04.1 LTS "Trusty". So, using the repository configuration tool, we will click on Ubuntu, then 14.04 LTS "trusty", and then on the MariaDB series we want to install. Lastly, we will click on the mirror we want to use. The tool will then output three pieces of text. The first contains the commands to add the MariaDB repository to our system. The second contains the commands to actually install MariaDB. The third block of text contains alternative instructions in case adding the repository using the first set did not work.
For example, the generated commands for adding a repository for MariaDB 10.1 for Ubuntu 14.04 LTS "trusty" and using the osuosl
mirror are as follows:
sudo apt-get install software-properties-common sudo apt-key adv --recv-keys \ --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db sudo add-apt-repository \ 'deb http://ftp.osuosl.org/pub/mariadb/repo/10.0/ubuntu trusty main'
The first command installs the software-properties-common
package if it is not already installed. This package contains the add-apt-repository
command we use to install the repository. The second command imports the GPG encryption key that is used to sign MariaDB packages. For more information about this key, see the MariaDB package security section later in this chapter. The third command adds the repository.
Now that the repository is configured, we can install MariaDB using the following installation commands:
sudo apt-get update sudo apt-get install mariadb-server
The mariadb-server
package depends on the other MariaDB packages, so these two commands are all we need to install MariaDB. Once the second
apt-get
command finishes, MariaDB will be installed and running.
To learn about installing MariaDB on Fedora, Red Hat, and CentOS, read on. Otherwise, jump ahead to the MariaDB package security section if you're interested in the MariaDB GPG signing keys, or skip to the After the installation section if you want to start using MariaDB right away.