Archival Notice
This guide was written for legacy Mautic v3/v4 deployments on CentOS 7 using PHP 7.4. Please note that PHP 7.4 and CentOS 7 have reached End of Life (EOL), and modern Mautic v5 releases require PHP 8.1+. Please adapt package installations and syntax to current environment standards.
When scaling digital marketing and newsletter campaigns, deploying an open-source marketing automation platform like Mautic allows organizations to manage leads, build automated email workflows, and track user engagement without recurring SaaS fees.
In this guide, I will walk you through preparing a CentOS 7 server, disabling SELinux, configuring MariaDB 10.8 repositories, applying database hardening, installing PHP 7.4 via Remi, and provisioning Mautic database user schemas.
Prerequisites
You will need a clean CentOS 7 virtual machine with root privileges, static IP addressing, and a minimum of 2 GB of RAM.
Step 1: Base System Preparation and SELinux Configuration
Update your system packages, install necessary networking utilities, and disable SELinux to prevent unexpected permission restrictions during web server execution.
# Update system and install utilities
yum update -y
yum install wget net-tools bash-completion epel-release -y
# Disable SELinux
sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
reboot
Step 2: Installing and Securing MariaDB 10.8
Mautic requires a highly performant database engine. Configure the official MariaDB 10.8 repository and install the server daemon.
# Configure MariaDB 10.8 repository manifest
cat > /etc/yum.repos.d/MariaDB.repo << "EOF"
[mariadb]
name = MariaDB
baseurl = https://mirrors.gigenet.com/mariadb/yum/10.8/centos7-amd64
gpgkey=https://mirrors.gigenet.com/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF
# Install MariaDB server
yum install MariaDB-server -y
# Enable and start MariaDB service
systemctl enable mariadb.service
systemctl start mariadb.service
Database Hardening (mariadb-secure-installation)
Secure the database installation by establishing root credentials and removing anonymous access:
mariadb-secure-installation
- Set root password?:
Y(provide strong password) - Remove anonymous users?:
Y - Disallow root login remotely?:
Y - Remove test database?:
Y - Reload privilege tables?:
Y
Step 3: Provisioning Mautic Database Schema
Log into the MariaDB prompt and create a dedicated database and user schema for Mautic:
mysql -u root -p
CREATE DATABASE mautic;
GRANT ALL ON mautic.* TO 'mauticuser'@'localhost' IDENTIFIED BY 'Randompassword';
FLUSH PRIVILEGES;
EXIT;
Step 4: Installing Apache and PHP 7.4 via Remi Repository
Mautic relies on PHP and extensive XML, IMAP, and database extensions. Configure the Remi repository and install PHP 7.4 alongside Apache.
# Install Apache web server
yum install httpd -y
systemctl enable httpd
systemctl start httpd
# Enable Remi repository for PHP 7.4
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
# Install PHP 7.4 and required Mautic extensions
yum install -y php74-php.x86_64 php74-php-xml php74-php-pdo php74-php-mcrypt php74-php-imap php74-php-posix php74-php-intl php74-php-mysqli php74-php-pear php74-php-curl php74-php-gd php74-php-pecl-zip.x86_64 php74-php-bcmath.x86_64 php74-php-mbstring.x86_64
Create a symbolic link to ensure the PHP binary is available system-wide:
ln -s /opt/remi/php74/root/bin/php /usr/bin/php
php -v
Mautic Server Prepared
Your CentOS 7 server is now fully equipped with MariaDB 10.8, Apache, and PHP 7.4! You can unpack the Mautic source code into your web root and launch the web installer wizard.