Installing MariaDB .deb Files

Installing MariaDB with APT

On Debian, Ubuntu, and other similar Linux distributions, it is highly recommended to install the relevant .deb packages from MariaDB's repository using apt, aptitude, Ubuntu Software Center, Synaptic Package Manager, or another package manager.

This page walks you through the simple installation steps using apt.

Adding the MariaDB APT repository

We currently have APT repositories for the following Linux distributions:

  • Debian 8 (Stretch)
  • Debian 9 (Jessie)
  • Debian Unstable (Sid)
  • Ubuntu 14.04 LTS (Trusty)
  • Ubuntu 16.04 LTS (Xenial)
  • Ubuntu 17.10 (Artful)
  • Ubuntu 18.04 LTS (Bionic)
  • Ubuntu 18.10 (Cosmic)
  • Mint 17 (Qiana)
  • Mint 17.1 (Rebecca)
  • Mint 18 (Sarah)
  • Mint 19 (Tara)

Using the MariaDB Package Repository Setup Script

If you want to install MariaDB with apt, then you can configure apt to install from MariaDB Corporation's MariaDB Package Repository by using the MariaDB Package Repository setup script.

MariaDB Corporation provides a MariaDB Package Repository for several Linux distributions that use apt to manage packages. This repository contains software packages related to MariaDB Server, including the server itself, clients and utilities, client libraries, plugins, and Mariabackup. The MariaDB Package Repository setup script automatically configures your system to install packages from the MariaDB Package Repository.

To use the script, execute the following command:

curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash

Note that this script also configures a repository for MariaDB MaxScale and a repository for MariaDB Tools, which currently only contains Percona XtraBackup and its dependencies.

See MariaDB Package Repository Setup and Usage for more information.

Using the MariaDB Repository Configuration Tool

If you want to install MariaDB with apt, then you can configure apt to install from MariaDB Foundation's MariaDB Repository by using the MariaDB Repository Configuration Tool.

The MariaDB Foundation provides a MariaDB repository for several Linux distributions that use apt-get to manage packages. This repository contains software packages related to MariaDB Server, including the server itself, clients and utilities, client libraries, plugins, and Mariabackup. The MariaDB Repository Configuration Tool can easily generate the appropriate commands to add the repository for your distribution.

There are several ways to add the repository.

Executing add-apt-repository

One way to add an apt repository is by using the add-apt-repository command.

For example, if you wanted to use the repository to install MariaDB 10.3 on Ubuntu 18.04 LTS (Bionic), then you could use the following commands to add the MariaDB apt repository:

sudo apt-get install software-properties-common
sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main'

And then you would have to update the package cache by executing the following command:

sudo apt update
Creating a Source List File

Another way to add an apt repository is by creating a source list file in /etc/apt/sources.list.d/.

For example, if you wanted to use the repository to install MariaDB 10.3 on Ubuntu 18.04 LTS (Bionic), then you could create the MariaDB.list file in /etc/apt/sources.list.d/ with the following contents to add the MariaDB apt repository:

# MariaDB 10.3 repository list - created 2019-01-27 09:50 UTC
# http://downloads.mariadb.org/mariadb/repositories/
deb [arch=amd64,arm64,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main
deb-src http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main

And then you would have to update the package cache by executing the following command:

sudo apt update
Using Ubuntu Software Center

Another way to add an apt repository is by using Ubuntu Software Center.

You can do this by going to the Software Sources window. This window can be opened either by navigating to Edit > Software Sources or by navigating to System > Administration > Software Sources.

Once the Software Sources window is open, go to the Other Software tab, and click the Add button. At that point, you can input the repository information provided by the MariaDB Repository Configuration Tool.

See here for more information.

Using Synaptic Package Manager

Another way to add an apt repository is by using Synaptic Package Manager.

You can do this by going to the Software Sources window. This window can be opened either by navigating to System > Administrator > Software Sources or by navigating to Settings > Repositories.

Once the Software Sources window is open, go to the Other Software tab, and click the Add button. At that point, you can input the repository information provided by the MariaDB Repository Configuration Tool.

See here for more information.

Pinning the MariaDB Repository to a Specific Minor Release

If you wish to pin the apt repository to a specific minor release, or if you would like to downgrade to a specific minor release, then you can create a apt repository with the URL hard-coded to that specific minor release.

The MariaDB Foundation archives repositories of old minor releases at the following URL:

For example, if you wanted to pin your repository to MariaDB 10.3.9 on Ubuntu 18.04 LTS (Bionic), then you would have to first remove any existing MariaDB repository source list file from /etc/apt/sources.list.d/. And then you could use the following commands to add the MariaDB apt-get repository:

sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://archive.mariadb.org/mariadb-10.3.9/repo/ubuntu/ bionic main'

And then you would have to update the package cache by executing the following command:

sudo apt update

Importing the MariaDB GPG Public Key

Before MariaDB can be installed, you also have to import the GPG public key that is used to verify the digital signatures of the packages in our repositories. This allows the apt utility to verify the integrity of the packages that it installs.

  • Prior to Debian 9 (Stretch), and Debian Unstable (Sid), and Ubuntu 16.04 LTS (Xenial), the id of our GPG public key is 0xcbcb082a1bb943db. The full key fingerprint is:
1993 69E5 404B D5FC 7D2F E43B CBCB 082A 1BB9 43DB

The apt-key utility can be used to import this key. For example:

sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
  • Starting with Debian 9 (Stretch), and Debian Unstable (Sid), and Ubuntu 16.04 LTS (Xenial), the id of our GPG public key is 0xF1656F24C74CD1D8. The full key fingerprint is:
177F 4010 FE56 CA33 3630  0305 F165 6F24 C74C D1D8

The apt-key utility can be used to import this key. For example:

sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8

Starting with Debian 9 (Stretch), the dirmngr package needs to be installed before the GPG public key can be imported. To install it, execute: sudo apt install dirmngr

If you are unsure which GPG public key you need, then it is perfectly safe to import both keys.

The command used to import the GPG public key is the same on both Debian and Ubuntu. For example:

$ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.ASyOPV87XC --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
gpg: requesting key 1BB943DB from hkp server keyserver.ubuntu.com
gpg: key 1BB943DB: "MariaDB Package Signing Key <package-signing-key@mariadb.org>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg:               imported: 1

Once the GPG public key is imported, you are ready to install packages from the repository.

Installing MariaDB with APT

After the apt repository is configured, you can install MariaDB by executing the apt-get command:

sudo apt-get install mariadb-server mariadb-client

If the server already has the mariadb-galera-server package installed, then you might need to remove it prior to installing the mariadb-server package. For example:

sudo apt-get remove mariadb-galera-server

No databases are removed when the mariadb-galera-server package is removed, but it is a good idea in general to have backups when performing upgrades or making major packaging changes.

Installing Older Versions from the Repository

The MariaDB apt repository contains the last few versions of MariaDB. To show what versions are available, use the apt-cache command:

sudo apt-cache showpkg mariadb-server

In the output you will see the available versions.

To install an older version of a package instead of the latest version we just need to specify the package name, an equal sign, and then the version number.

However, when installing an older version of a package, if apt-get has to install dependencies, then it will automatically choose to install the latest versions of those packages. To ensure that all MariaDB packages are on the same version in this scenario, it is necessary to specify them all.

The packages that the mariadb-server package depend on are: mariadb-client, mariadb-shared, and mariadb-common. Therefore, to install mariadb 10.3.11 from this apt repository, we would do the following:

sudo apt-get install mariadb-server=10.3.11-1 mariadb-client=10.3.11-1 mariadb-shared=10.3.11-1 mariadb-common=10.3.11-1

The rest of the install and setup process is as normal.

Installing MariaDB Galera Cluster with APT

MariaDB Galera Cluster until 10.0

Galera Cluster support required special MariaDB Server packages in MariaDB 5.5 and MariaDB 10.0. Galera Cluster support has been included in the standard MariaDB Server packages in MariaDB 10.1 and above.

The process to install MariaDB Galera Cluster with the MariaDB apt-get repository is practically the same as installing standard MariaDB Server. When using MariaDB Galera Cluster 5.5 or MariaDB Galera Cluster 10.0, the major difference is that you will need to install the mariadb-galera-server package instead of the mariadb-server package. When using MariaDB 10.1 and above, Galera Cluster support has been included in the standard MariaDB Server packages, so you will need to install the mariadb-server package, as you normally would.

You also need to install the galera package to obtain the Galera wsrep provider library.

To install MariaDB Galera Cluster 5.5 or MariaDB Galera Cluster 10.0, you could execute:

sudo apt-get install mariadb-galera-server mariadb-client galera

If the server already has the mariadb-server package installed, then you might need to remove it prior to installing mariadb-galera-server package. For example, by executing:

sudo apt-get remove mariadb-server

No databases are removed when the mariadb-server package is removed, but it is a good idea in general to have backups when performing upgrades or making major packaging changes.

And to install MariaDB 10.1 and above with Galera Cluster, you could execute:

sudo apt-get install mariadb-server mariadb-client galera

MariaDB Galera Cluster also has a galera-arbitrator-3 package. This package should be installed on whatever node you want to serve as the arbitrator. It can either run on a separate server that is not acting as a cluster node, which is the recommended configuration, or it can run on a server that is also acting as an existing cluster node. To install it, you could execute:

sudo apt-get install galera-arbitrator-3

See MariaDB Galera Cluster for more information on MariaDB Galera Cluster.

Installing MariaDB with dpkg

While it is not recommended, it is possible to download and install the .deb packages manually. However, it is generally recommended to use a package manager like apt-get. Browse the directories below the "repo/" directory on your closest mirror. The .deb files are in debian/pool/ and ubuntu/pool/, respectively.

Here are the commands we used on a Debian 5 amd64 box to install MariaDB 5.1.42 (other Debian-based distributions should be similar):

sudo apt-get update
sudo apt-get install libdbi-perl libdbd-mysql-perl psmisc
sudo dpkg --install mysql-common_5.1.42-mariadb73_all.deb
sudo dpkg --install libmariadbclient16_5.1.42-mariadb73_amd64.deb libmysqlclient16_5.1.42-mariadb73_amd64.deb \
mariadb-client_5.1.42-mariadb73_all.deb mariadb-client-5.1_5.1.42-mariadb73_amd64.deb mariadb-server_5.1.42-mariadb73_all.deb \
mariadb-server-5.1_5.1.42-mariadb73_amd64.deb

After Installation

After the installation is complete, you can start MariaDB.

If you are using MariaDB Galera Cluster, then keep in mind that the first node will have to be bootstrapped.

Installation Issues

MariaDB starting with 5.5

Upgrading mariadb-server and mariadb-client packages

As noted in MDEV-4266, the mariadb-server and mariadb-client packages have a minor upgrade issue if you use 'apt-get install mariadb-server' or 'apt-get install mariadb-client' to upgrade them instead of the more common 'apt-get upgrade'. This is because those two packages depend on mariadb-server-5.5 and mariadb-client-5.5 with no specific version of those packages. For example, if you have the mariadb-server package installed, version 5.5.29 and you install version 5.5.30 of that package it will not automatically upgrade the mariadb-server-5.5 package to version 5.5.30 like you would expect because the 5.5.29 version of that package satisfies the dependency.

The mariadb-server and mariadb-client packages are virtual packages, they only exist to require the installation of the mariadb-server-5.5 and mariadb-client-5.5 packages, respectively. MariaDB will function normally with a, for example, version 5.5.30 version of the mariadb-server package and a version 5.5.29 version of the mariadb-server-5.5 package. No data is at risk. However, expected behavior is for 'apt-get install mariadb-server' to upgrade everything to the latest version (if a new version is available), so this is definitely a bug.

A fix is planned for this bug in a future version of MariaDB. In the mean time, when upgrading MariaDB, use 'apt-get upgrade' or 'apt-get install mariadb-server-5.5'.

MariaDB 5.1 - 5.5

Version Mismatch Between MariaDB and Ubuntu/Debian Repositories

As mentioned here (and in MDEV-4080 and MDEV-3882) sometimes APT will refuse to install MariaDB. Or, if MariaDB is already installed, suggest the removal of MariaDB to apply an upgrade to the mysql-common or libmysqlclient packages. This happens whenever the version number of those two packages is higher in the distribution repositories than the versions in the MariaDB repositories. Most MariaDB packages have different names than their MySQL counterparts, but in order for upgrades from MySQL to MariaDB to be successful in APT, those two packages must be named the same. Because they have the same names, APT just checks the version numbers and tries to install what it considers to be the most recent.

It is rare for the version numbers of mysql-common or libmysqlclient to be higher in the official Ubuntu or Debian repositories than they are in the MariaDB repositories, but it has happened. Whenever it has it has been because of critical bug fix releases for bugs that existed in the version of MySQL in the distribution repositories but which had already been fixed in the version of MariaDB in the MariaDB repositories.

If a situation as described above exists when you try to install MariaDB you will get an error like this:

The following packages have unmet dependencies:
 mariadb-server : Depends: mariadb-server-5.5 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

There are three primary ways of fixing this issue:

  1. Pinning the MariaDB Repository
  2. Specifying Specific Versions to Install
  3. Holding Packages

Click on the links above to jump to directions for each (or simply scroll down).

Pinning the MariaDB Repository

It is possible to pin the MariaDB repository used so the packages it provides will always have an higher priority over the ones from the system repositories.

This is done by creating a file with the '.pref' extension under '/etc/apt/preferences.d/' with the following contents:

Package: *
Pin: origin <mirror-domain>
Pin-Priority: 1000

Replace '<mirror-domain>' with the domain name of the MariaDB mirror you use. For example 'ftp.osuosl.org'.

Specifying Specific Versions to Install

A way to fix this is to specify the exact version of the two packages that you want to install. To do this, first determine the full version numbers of the affected packages. An easy way to do so is with 'apt-cache show':

apt-cache show mysql-common | grep Version
apt-cache show libmysqlclient18 | grep Version

For each of the above you will be given a list of versions. The ones in the MariaDB repositories will have "mariadb" in the version strings and are the ones you want. With the version numbers in hand you will be able to install MariaDB by explicitly specifying the version numbers like so:

apt-get install mariadb-server-5.5 mariadb-client-5.5 \
  libmysqlclient18=<version-number> \
  mysql-common=<version-number>

Replace the two instances of <version-number> in the example above with the actual version number of MariaDB that you want to install.

Even after having installed these specific packages versions, running 'apt-get dist-upgrade' will still try to upgrade the packages to the highest version available.

Holding Packages

After MariaDB is installed, and as long as the version number issue exists, an 'apt-get dist-upgrade' will try to remove MariaDB in order to install the "upgraded" libmysqlclient and mysql-common packages. To prevent this from happening you can hold them so that apt doesn't try to upgrade them. To do so, open a terminal, become root with 'sudo -s', and then enter the following:

echo libmysqlclient18 hold | dpkg --set-selections
echo mysql-common hold | dpkg --set-selections

The holds will prevent you from upgrading MariaDB, so when you want to remove the holds, open a terminal, become root with 'sudo -s', and then enter the following:

echo libmysqlclient18 install | dpkg --set-selections
echo mysql-common install | dpkg --set-selections

You will then be able to upgrade MariaDB as normal (e.g. with 'sudo apt-get update; sudo apt-get upgrade').

.deb files Distributed as Part of MariaDB

Each version of MariaDB includes different files, as new features are added (or removed), package names are updated to match the version number the product, and different platforms allow for particular components to be built that cannot be built on other platforms.

Here's an example list of all the .deb files distributed for MariaDB 10.1.17 on Ubuntu Xenial (16.04 LTS):

  • galera-3_25.3.17-xenial_amd64.deb
  • galera-arbitrator-3_25.3.17-xenial_amd64.deb
  • libmariadbclient18_10.1.17+maria-1xenial_amd64.deb
  • libmariadbclient-dev_10.1.17+maria-1xenial_amd64.deb
  • libmariadbd-dev_10.1.17+maria-1xenial_amd64.deb
  • libmysqlclient18_10.1.17+maria-1xenial_amd64.deb
  • mariadb-client-10.1_10.1.17+maria-1xenial_amd64.deb
  • mariadb-client_10.1.17+maria-1xenial_all.deb
  • mariadb-client-core-10.1_10.1.17+maria-1xenial_amd64.deb
  • mariadb-common_10.1.17+maria-1xenial_all.deb
  • mariadb-connect-engine-10.1_10.1.17+maria-1xenial_amd64.deb
  • mariadb-cracklib-password-check-10.1_10.1.17+maria-1xenial_amd64.deb
  • mariadb-gssapi-client-10.1_10.1.17+maria-1xenial_amd64.deb
  • mariadb-gssapi-server-10.1_10.1.17+maria-1xenial_amd64.deb
  • mariadb-oqgraph-engine-10.1_10.1.17+maria-1xenial_amd64.deb
  • mariadb-server-10.1_10.1.17+maria-1xenial_amd64.deb
  • mariadb-server_10.1.17+maria-1xenial_all.deb
  • mariadb-server-core-10.1_10.1.17+maria-1xenial_amd64.deb
  • mariadb-test_10.1.17+maria-1xenial_all.deb
  • mysql-common_10.1.17+maria-1xenial_all.deb

See Also

Comments

Comments loading...