How to install MariaDB on CentOS 7 / RHEL 7

We previously wrote about MariaDB Server on RHEL 7 in October, 2014. MariaDB Server has grown substantially in the past 6 years, so in February, 2020 we’ve provided a refresh of this topic. If you’re looking for our old words, you can find them here.

About RHEL 7 and CentOS 7

Red Hat Enterprise Linux 7 (RHEL 7) was released back in 2014, and has had seven point releases since. The CentOS Project follows releases of upstream RHEL source code with community binary builds a few months later. CentOS Linux 7 was released in July 2014. MariaDB Server is available for use on both RHEL 7 and CentOS 7.

Red Hat has announced that RHEL 7.7 will be the last point release on the RHEL 7.x release series, so we expect users will be looking to upgrade to RHEL 8 before support for RHEL 7.7 concludes in August 2021. If you are looking to upgrade, you may enjoy our blog, “How to install MariaDB Server on RHEL 8 / CentOS 8“.

MariaDB Server is available and supported on RHEL 7 and CentOS 7, and is easily deployed from OS vendor repositories or MariaDB repositories using YUM.

Installing MariaDB Server

The RHEL 7 and CentOS 7 distributions include MariaDB Server 5.5 by default.

You can install MariaDB Server from the command-line:

$ sudo yum install mariadb-server

Benefits of MariaDB Server 10.4

While CentOS 7 and RHEL 7 include MariaDB Server 5.5, substantial improvements have been made as MariaDB Community Server changed through the 10.0, 10.1, 10.2, 10.3, and 10.4 release series. The MariaDB Server 10.4 release series includes:

  • Instant ALTER for InnoDB tables
  • Optimizer trace to aid in performance diagnosis
  • Window functions and Common Table Expressions (CTE)
  • Temporal tables, including system-versioned, application time-period, and bitemporal (both)
  • Ability to reload SSL certificates without server restart
  • Galera 4 technology, a major enhancement over Galera 3
  • Additional storage engines, including MyRocks
  • SQL_MODE=ORACLE for compatibility with a subset of Oracle PL/SQL
  • Expanded data-at-rest encryption
  • Authentication enhancements, including multiple authentication methods per user

Installing MariaDB Server 10.4

To deploy MariaDB Community Server 10.4 on RHEL 7 or CentOS 7, first download and use the mariadb_repo_setup script to configure the MariaDB repositories for YUM:

$ sudo yum install wget
$ wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
$ chmod +x mariadb_repo_setup
$ sudo ./mariadb_repo_setup

To install MariaDB Community Server and dependencies:

$ sudo yum install MariaDB-server

Configuring and Securing MariaDB Server

Start the systemd service for MariaDB Server 5.5 or 10.4 using systemctl:

$ sudo systemctl start mariadb.service

Specific security practices should always follow any business-specific requirements and governance. Some basic steps should be taken to help harden the MariaDB Community Server 5.5 or 10.4 deployment:

$ sudo mysql_secure_installation

MariaDB Enterprise Server

MariaDB Corporation provides commercial support for MariaDB Platform, which includes MariaDB Enterprise Server. MariaDB Enterprise Server is supported on a range of operating systems, including RHEL 7 and CentOS 7.

MariaDB Enterprise Server is based on MariaDB Community Server, and ships with enhanced features including:

  • Predictable releases through an Enterprise Lifecycle
  • Enhanced configuration defaults
  • MariaDB Enterprise Audit, with expanded functionality over the MariaDB Audit Plugin
  • MariaDB Enterprise Backup, with hot online backups
  • MariaDB Enterprise Cluster, with expanded encryption over MariaDB Cluster (Galera)

Want to hear more? Contact us or see the MariaDB Enterprise Documentation.