Installing MariaDB with yum/dnf
On RHEL, CentOS, Fedora, and other similar Linux distributions, it is highly recommended to install the relevant RPM packages from MariaDB's
repository using yum
or dnf
. Starting with RHEL 8 and Fedora 22, yum
has been replaced by dnf
, which is the next major version of yum
. However, yum
commands still work on many systems that use dnf
.
This page walks you through the simple installation steps using yum
.
Contents
- Adding the MariaDB YUM repository
- Updating the MariaDB YUM repository to a New Major Release
- Importing the MariaDB GPG Public Key
- Installing MariaDB Packages with YUM
- Installing the Most Common Packages with YUM
- Installing MariaDB Server with YUM
- Installing MariaDB Galera Cluster with YUM
- Installing MariaDB Clients and Client Libraries with YUM
- Installing Mariabackup with YUM
- Installing Plugins with YUM
- Installing Debug Info Packages with YUM
- Installing Older Versions from the Repository
- After Installation
Adding the MariaDB YUM repository
We currently have YUM repositories for the following Linux distributions:
- Red Hat Enterprise Linux (RHEL) 6
- Red Hat Enterprise Linux (RHEL) 7
- CentOS 6
- CentOS 7
- Fedora 27
- Fedora 28
- Fedora 29
Using the MariaDB Package Repository Setup Script
If you want to install MariaDB with yum
, then you can configure yum
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 yum
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 yum
, then you can configure yum
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 yum
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 configuration file to add the repository for your distribution.
Once you have the appropriate repository configuration section for your distribution, add it to a file named MariaDB.repo
under /etc/yum.repos.d/
.
For example, if you wanted to use the repository to install MariaDB 10.3 on CentOS 7, then you could use the following yum
repository configuration in /etc/yum.repos.d/MariaDB.repo
:
[mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.3/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
The example file above includes a gpgkey
line to automatically fetch the
GPG public key that is used to verify the digital signatures of the packages in our repositories. This allows the the yum
, dnf
, and rpm
utilities to verify the integrity of the packages that they install.
Pinning the MariaDB Repository to a Specific Minor Release
If you wish to pin the yum
repository to a specific minor release, or if you would like to do a yum downgrade
to a specific minor release, then
you can create a yum
repository configuration with a baseurl
option set to that specific minor release.
The MariaDB Foundation archives repositories of old minor releases at the following URL:
So if you can't find the repository of a specific minor release at yum.mariadb.org
, then it would be a good idea to check the archive.
For example, if you wanted to pin your repository to MariaDB 10.3.14 on CentOS 7, then you could use the following yum
repository configuration in /etc/yum.repos.d/MariaDB.repo
:
[mariadb] name = MariaDB-10.3.14 baseurl=http://yum.mariadb.org/10.3.14/centos7-amd64 # alternative: baseurl=http://archive.mariadb.org/mariadb-10.3.14/yum/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
Note that if you change an existing repository configuration, then you need to execute the following:
sudo yum clean all
Updating the MariaDB YUM repository to a New Major Release
MariaDB's yum
repository can be updated to a new major release. How this is done depends on how you originally configured the repository.
Updating the Major Release with the MariaDB Package Repository Setup Script
If you configured yum
to install from MariaDB Corporation's MariaDB Package Repository by using the MariaDB Package Repository setup script, then you can update the major release that the repository uses by running the script again.
Updating the Major Release with the MariaDB Repository Configuration Tool
If you configured yum
to install from MariaDB Foundation's MariaDB Repository by using the MariaDB Repository Configuration Tool, then you can update the major release that the repository uses by updating the yum
repository configuration file in-place. For example, if you wanted to change the repository from MariaDB 10.2 to MariaDB 10.3, and if the repository configuration file was at /etc/yum.repos.d/MariaDB.repo
, then you could execute the following:
sudo sed -i 's/10.2/10.3/' /etc/yum.repos.d/MariaDB.repo
After that, the repository should refer to MariaDB 10.3.
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 yum
, dnf
and rpm
utilities to verify the integrity of the packages that they install.
The id of our GPG public key is 0xcbcb082a1bb943db
. The short form of the id
is 0x1BB943DB
. The full key fingerprint is:
1993 69E5 404B D5FC 7D2F E43B CBCB 082A 1BB9 43DB
yum
should prompt you to import the GPG public key the first time that you install a package from MariaDB's repository. However, if you like, the rpm
utility can be used to manually import this key instead. For example:
sudo rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
Once the GPG public key is imported, you are ready to install packages from the repository.
Installing MariaDB Packages with YUM
After the yum
repository is configured, you can install MariaDB by executing the yum
command. The specific command that you would use would depend on which specific packages that you want to install.
Installing the Most Common Packages with YUM
To Install the most common packages, execute the following command:
sudo yum install MariaDB-server galera MariaDB-client MariaDB-shared MariaDB-backup MariaDB-common
Installing MariaDB Server with YUM
To Install MariaDB Server, execute the following command:
sudo yum install MariaDB-server
Installing MariaDB Galera Cluster with YUM
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 yum
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 yum install MariaDB-Galera-server MariaDB-client galera
If you haven't yet imported the MariaDB GPG public key, then yum
will prompt you to
import it after it downloads the packages, but before it prompts you to install them.
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 yum 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 yum install MariaDB-server MariaDB-client galera
See MariaDB Galera Cluster for more information on MariaDB Galera Cluster.
Installing MariaDB Clients and Client Libraries with YUM
In MariaDB 10.2 and later, MariaDB Connector/C has been included as the client library. However, the package name for the client library has not been changed.
To Install the clients and client libraries, execute the following command:
sudo yum install MariaDB-client MariaDB-shared
Installing Mariabackup with YUM
To install Mariabackup, execute the following command:
sudo yum install MariaDB-backup
Installing Plugins with YUM
Some plugins may also need to be installed.
For example, to install the cracklib_password_check
password validation plugin, execute the following command:
sudo yum install MariaDB-cracklib-password-check
Installing Debug Info Packages with YUM
MariaDB starting with 5.5.64
The MariaDB yum
repository first added debuginfo
packages in MariaDB 5.5.64, MariaDB 10.1.39, MariaDB 10.2.23, MariaDB 10.3.14, and MariaDB 10.4.4.
The MariaDB yum
repository also contains debuginfo
packages. These package may be needed when debugging a problem.
Installing Debug Info for the Most Common Packages with YUM
To install debuginfo
for the most common packages, execute the following command:
sudo yum install MariaDB-server-debuginfo MariaDB-client-debuginfo MariaDB-shared-debuginfo MariaDB-backup-debuginfo MariaDB-common-debuginfo
Installing Debug Info for MariaDB Server with YUM
To install debuginfo
for MariaDB Server, execute the following command:
sudo yum install MariaDB-server-debuginfo
Installing Debug Info for MariaDB Clients and Client Libraries with YUM
In MariaDB 10.2 and later, MariaDB Connector/C has been included as the client library. However, the package name for the client library has not been changed.
To install debuginfo
for the clients and client libraries, execute the following command:
sudo yum install MariaDB-client-debuginfo MariaDB-shared-debuginfo
Installing Debug Info for Mariabackup with YUM
To install debuginfo
for Mariabackup, execute the following command:
sudo yum install MariaDB-backup-debuginfo
Installing Debug Info for Plugins with YUM
For some plugins, debuginfo
may also need to be installed.
For example, to install debuginfo
for the cracklib_password_check
password validation plugin, execute the following command:
sudo yum install MariaDB-cracklib-password-check-debuginfo
Installing Older Versions from the Repository
The MariaDB yum
repository contains the last few versions of MariaDB. To show what versions are available, use the following command:
yum list --showduplicates MariaDB-server
In the output you will see the available versions. For example:
$ yum list --showduplicates MariaDB-server Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: centos.mirrors.ovh.net * extras: centos.mirrors.ovh.net * updates: centos.mirrors.ovh.net Available Packages MariaDB-server.x86_64 10.3.10-1.el7.centos mariadb MariaDB-server.x86_64 10.3.11-1.el7.centos mariadb MariaDB-server.x86_64 10.3.12-1.el7.centos mariadb mariadb-server.x86_64 1:5.5.60-1.el7_5 base
The MariaDB yum
repository in this example contains MariaDB 10.3.10, MariaDB 10.3.11, and MariaDB 10.3.12. The CentOS base yum
repository also contains MariaDB 5.5.60.
To install an older version of a package instead of the latest version we just need to specify the package name, a dash, and then the version number. And we only need to specify enough of the version number for it to be unique from the other available versions.
However, when installing an older version of a package, if yum
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 yum
repository, we would do the following:
sudo yum install MariaDB-server-10.3.11 MariaDB-client-10.3.11 MariaDB-shared-10.3.11 MariaDB-backup-10.3.11 MariaDB-common-10.3.11
The rest of the install and setup process is as normal.
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.