MariaDB Package Repository setup and usage

You are viewing an old version of this article. View the current version here.

Overview

A convenient shell script to set up the MariaDB Package Repository is available at https://downloads.mariadb.com/MariaDB/mariadb_repo_setup. It can be executed like this:

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

You will need to execute the script as root, so that it can write repository definition files. If you want to see the repository definition file that will be created without needing to run the script as root, use the --write-to-stdout option.

The script will will set up 3 packages repositories in a single repository definition file:

  • MariaDB Server/Cluster
    • This repository will be set up to use the latest GA version of MariaDB Server/Cluster at the time the script is run, today "mariadb-10.1". When the next major version is released, the script will be updated to use that version, but you will not be automatically upgraded to the next version.
  • MariaDB MaxScale
    • This repository will be set up to use the latest GA version of MariaDB MaxScale. This is handled by a symlink "latest" that will be updated on the next GA release of MariaDB MaxScale.
  • A tools repository that includes Percona XtraBackup and its dependencies

The script will remove the mariadb-enterprise-repository package if it's installed. This is to avoid conflicts between the packages provided by the MariaDB Enterprise Repository and the MariaDB Package Repository configured by this script.

The script will also install trusted keys used to sign MariaDB software packages (see --skip-key-import below if you want to avoid that behavior).

If the repository file the script tries to create already exists, the script will rename the file and give it an extension (of the format ".old_[0-9]+") that is ignored by the OS's package manager. You can safely remove those files.

Platform support

The script supports GNU/Linux operating systems officially supported under MariaDB Enterprise subscriptions (though a MariaDB Enterprise subscription is not required to use the MariaDB Package Repository). As of May 2017, these include:

  • Red Hat Enterprise Linux (RHEL)/CentOS 6 and 7
  • Debian 7 (wheezy) and 8 (jessie)
  • Ubuntu 14.04 LTS (trusty) and 16.04 LTS (xenial)
  • SUSE Linux Enterprise Server (SLES) 12

To install MariaDB Server/Cluster (but not MariaDB MaxScale or Percona XtraBackup) on other platforms, please consider using MariaDB Foundation's repository configuration tool or installing MariaDB from your OS distribution.

Platform-specific behavior

On Ubuntu and Debian,

  • a repository definition file will be created at /etc/apt/sources.list.d/mariadb.list
  • a file will be created at /etc/apt/preferences.d/mariadb-enterprise.pref to give packages from MariaDB repositories highest priority, in order to avoid conflicts with packages from OS and other repositories:
    Package: *
    Pin: origin downloads.mariadb.com
    Pin-Priority: 1000
    
  • apt-key will be used to import package signing keys from the keyserver.ubuntu.com key server
  • apt-get update will be executed to update the package cache with package definitions from the MariaDB Package Repository.

On Red Hat Enterprise Linux (RHEL) and CentOS,

  • a repository definition file will be created at /etc/yum.repos.d/mariadb.repo
  • rpm --import will be used to import package signing keys from https://downloads.mariadb.com.

On SUSE Linux Enterprise Server (SLES),

  • a repository definition file will be created at /etc/zypp/repos.d/mariadb.repo
  • rpm --import will be used to import package signing keys from https://downloads.mariadb.com.

Options

To provide options to the script, you must tell bash to expect them by executing bash with the options -s --, like this:

curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup |
    sudo bash -s -- --help
OptionDescription
--helpDisplay a usage message and exit.
--mariadb-server-version=<version>Override the default MariaDB Server version. By default, the script will use 'mariadb-10.1'.
--mariadb-maxscale-version=<version>Override the default MariaDB MaxScale version. By default, the script will use 'latest'.
--os-type=<type>Override detection of OS type. Acceptable values include debian, ubuntu, rhel, and sles.
--os-version=<version>Override detection of OS version. Acceptable values depend on the OS type you specify.
--skip-key-importSkip importing GPG signing keys.
--skip-serverSkip the 'MariaDB Server' repository.
--skip-maxscaleSkip the 'MaxScale' repository.
--skip-toolsSkip the 'Tools' repository.
--write-to-stdoutWrite output to stdout instead of to the OS's repository configuration. This will also skip importing GPG keys and updating the package cache on platforms where that behavior exists.

--mariadb-server-version

By default, the repository will be set up to install the latest GA version of MariaDB Server/Cluster at the time you run the script, currently MariaDB Server/Cluster 10.1. If a new major GA release occurs, you will need to manually edit the repository definition, or fetch and run the mariadb_repo_setup script again.

The MariaDB Server/Cluster version used can be specified using the --mariadb-server-version option to the script. Prepend mariadb- to the version number you want, for example mariadb-10.2.

MariaDB Server/Cluster major versions mariadb-5.5, mariadb-10.0, mariadb-10.1, and mariadb-10.2 are supported. You can also specify a specific minor version, such as mariadb-5.5.55, if you don't want upgrades for automatic security fixes (this is not recommended).

--mariadb-maxscale-version

By default, the repository will be set up to install the latest GA version of MariaDB MaxScale. If a new version of MaxScale is released after you create the repository, your package manager will automatically upgrade you to that new GA version. In some cases, this can introduce incompatibilities; please consult the MaxScale release notes for more information.

The MaxScale version used can be specified using the --mariadb-maxscale option to the script.

MaxScale major versions 1.4, 2.0, and 2.1 are supported. Also, symlinks latest and beta are supported, if you want to be automatically upgraded to the latest GA or beta release, respectively.

--os-type and --os-version

If you want to run this script on an unsupported OS that you believe to be package-compatible with a supported OS, you can use the --os-type and --os-version options to override OS detection. If you use either option, you must use both options.

The allowed values for --os-type are debian, ubuntu, rhel, and sles. If you use some other value, the script will fail just as it would if you ran it on an unsupported OS.

The allowed values for --os-version are entirely dependent on the OS type. For RHEL or CentOS, for example, 6 and 7 are accepted. For Ubuntu and Debian, you must use their release codenames, such as xenial or jessie.

This is useful, for example, if you are using Linux Mint 8.1, which is based on and fully compatible with Ubuntu 16.04 LTS (xenial), you can use --os-type=ubuntu and --os-version=xenial to set up the MariaDB Package Repository using Ubuntu Xenial packages.

--write-to-stdout

The --write-to-stdout option will prevent the script from modifying anything on the system. The repository file will not be written to disk; rather, it will be printed to stdout so it can be reviewed, redirected elsewhere, consumed by another script, or used in some other way.

The --write-to-stdout option automatically enables --skip-key-import.

Examples

To set up the MariaDB Package Repository to install MariaDB Server 10.0, execute mariadb_repo_setup like this:

curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup |
    sudo bash -s -- --mariadb-server-version=mariadb-10.0

Installing packages

After setting up the MariaDB Package Repository, you can install the principal components of the MariaDB Enterprise offering.

  • MariaDB Server/Cluster
    • RHEL/CentOS
      • yum install MariaDB-server
      • or MariaDB-Galera-server to install MariaDB Galera Cluster before 10.1
    • Ubuntu/Debian
      • apt-get install mariadb-server
      • or mariadb-galera-server to install MariaDB Galera Cluster before 10.1
    • SLES
      • zypper install MariaDB-server
      • or MariaDB-Galera-server to install MariaDB Galera Cluster before 10.1
  • MariaDB MaxScale
    • RHEL/CentOS
      • yum install maxscale
    • Ubuntu/Debian
      • apt-get install maxscale
    • SLES
      • zypper install maxscale
  • Percona XtraBackup
    • RHEL/CentOS
      • yum install percona-xtrabackup
    • Ubuntu/Debian
      • apt-get install percona-xtrabackup
    • SLES
      • zypper install percona-xtrabackup

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.