Installing MariaDB with zypper
On SLES, OpenSUSE, and other similar Linux distributions, it is highly recommended to install the relevant RPM packages from MariaDB's
repository using zypper
.
This page walks you through the simple installation steps using zypper
.
Contents
Adding the MariaDB ZYpp repository
We currently have ZYpp repositories for the following Linux distributions:
- SLES 12
- SLES 15
- OpenSUSE 15
- OpenSUSE 42
Using the MariaDB Package Repository Setup Script
An easy way to add the MariaDB zypper
repository is to use the script that sets up the MariaDB Package Repository. For example:
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
Using the MariaDB Repository Generator
Another easy way to add the MariaDB zypper
repository is to use the MariaDB Repository Generator.
We have yum
repositories for several Linux distributions that use zypper
to manage packages. The MariaDB Repository Generator can easily generate the appropriate commands to add the repository for your distribution.
For example, if you wanted to use the repository to install MariaDB 10.3 on SLES 15, then you could use the following commands to add the MariaDB zypper
repository:
sudo rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB sudo zypper addrepo --gpgcheck --refresh https://yum.mariadb.org/10.3/sles/15/x86_64 mariadb sudo zypper --gpg-auto-import-keys refresh
The example above imports the GPG public key that we use to digitally sign the packages in our repositories. This key enables the zypper
and rpm
utilities to verify the integrity of the packages that they install.
The id of our signing key is 0xcbcb082a1bb943db
. The short form of the id
is 0x1BB943DB
and the full key fingerprint is:
1993 69E5 404B D5FC 7D2F E43B CBCB 082A 1BB9 43DB
Pinning the MariaDB Repository to a Specific Minor Release
If you wish to pin the zypper
repository to a specific minor release, or if you would like to downgrade to a specific minor release, then
you can create a zypper
repository with the URL hard-coded to that specific minor release.
For example, if you wanted to pin your repository to MariaDB 10.3.9 on SLES 15, then you could use the following yum
repository configuration in /etc/yum.repos.d/MariaDB.repo
:
sudo zypper removerepo mariadb sudo zypper addrepo --gpgcheck --refresh https://yum.mariadb.org/10.3.9/sles/15/x86_64 mariadb
Installing MariaDB with ZYpp
After the zypper
repository is configured, you can install MariaDB by executing the following command:
sudo zypper install MariaDB-server MariaDB-client
If you haven't yet imported the MariaDB GPG public key, then zypper
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-Galera-server
package installed, then you
might need to remove it prior to installing the MariaDB-server
package. For example:
sudo zypper 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 zypper
repository contains the last few versions of MariaDB. To show what versions are available, use the following command:
zypper search --details 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, 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 zypper
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 zypper
repository, we would do the following:
sudo zypper install MariaDB-server-10.3.11 MariaDB-client-10.3.11 MariaDB-shared-10.3.11 MariaDB-common-10.3.11
The rest of the install and setup process is as normal.
Installing MariaDB Galera Cluster with ZYpp
MariaDB 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 zypper
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 zypper install MariaDB-Galera-server MariaDB-client galera
If you haven't yet imported the MariaDB GPG public key, then zypper
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 zypper 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 zypper install MariaDB-server MariaDB-client galera
See MariaDB Galera Cluster for more information on MariaDB Galera Cluster.
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.