Skip to content

Mautic 5.1 Install on Ubuntu 24.04, PHP 8.2, MariaDB 11.4

A very promising, long-standing stack for Mautic 5!

This is, in my opinion, a software stack that is going to be widely used for several years. The planets (software versions) are now perfectly aligned for a great stack that will last a long time. Ubuntu 24.04 is a great base for Mautic 5 instances, and we can now enjoy PHP 8.2 and MariaDB 11.4, your Mautic setup will run faster than ever and your database will self optimize better than ever before.

5 Simple Steps to Install Mautic 5.1

  1. Install the packages required to run Mautic 5.
  2. Install Mautic 5.1.0
  3. Run the Mautic 5 configuration wizard.
  4. Install the Mautic 5 Cron Jobs.
  5. Enjoy your first Mautic 5 installation!


Should I install Mautic 4 when Mautic 5 is already available?
Don’t get fooled by the new and sparkly Mautic 5, it is too soon to use it in production, If you need stability, go for the tried and true, far more reliable Mautic 4 instead, because it is:
– Well tested, very stable, no known major bugs.
– Security fixes are up-to-date.
– Existing bugs in M4 are known and already fixed in Mautic 4.4.12
– Uses older, stabler versions of the entire stack (Ubuntu, MariaDB, PHP, etc…)
– Stack will not vary over time as it is very mature.
All that said, let’s install Mautic 5.1! or ——>>> Check out the Mautic 4 installation tutorial instead <<<——

Updated on June, 17 for Mautic 5.1.0

If you are new to Mautic or to the Linux command line, this installation tutorial was made specifically for you, it’s the simplest way to get started as I carefully designed it to have the fewer amount of commands possible so it’s easier to understand and the probability of anything going sideways is minimal.

It’s designed to give you a quick success using the command line so you can have an easy victory and gain the confidence to later advance towards more complex, more secure, and better-optimized setups.

What all this means is very reduced chanced of hitting a bug or compatibility issue with this setup.
If you do hit a bug, it will most probably be already well known and resolved and the solution is out there.

Pre-requisites for installing Mautic 5

  • A server or VPS connected to the internet.
  • A public IP and a domain or sub-domain.
  • SSH access to your server or VPS.

In this Mautic installation tutorial, we will be using:

  • Ubuntu 24.04
  • PHP 8.2
  • Maria DB 11.4 LTS
  • Mautic 5.1.0

Ubuntu 24.04

It’s been 20 years already since the launch of Ubuntu, 20 freaking years!!! And as a celebration, Ubuntu 24.04 is here.
This new LTS version will be maintained for 5 years for free users and up to 10 years for paid support users and incorporates the latest Linux Kernel 6.7 and 6.8.

PHP 8.2

Mautic 5.1 brings long awaited support for PHP 8.2, meaning Mautic is again on the “PHP supported track”, at least until Dec 2024.
PHP 8.2 brings in, among many other things, some speed improvements and bug fixes which can potentially impact a Mautic instance, like:
Intl: Fixed build regression on systems without C++17 compilers.
Opcache: Fixed bug GH-14109 (Accidental persisting of internal class).
OpenSSL: Security fix.

Symfony performance on PHP.
  • Tested version: Symfony 6.3.0. – Size: 559,000 bytes.
  • Results: PHP 8.1: 931 req/s. PHP 8.2: 997 req/s. PHP 8.3: 1182 req/s.
Symfony 6.3.0 performance on PHP 8.1, 8.2, and 8.3 (in requests/second).

Looking great, about 7-8% improvement. And looking even better for whenever we get php8.3, with a 12-15% improvement on top of it. Because of the even greater promise of PHP 8.4, this is the only component of this stack I see changing relatively soon, as soon as the Mautic Developers can give us support.

Maria DB 11.4 LTS

Oh yes! I’m going to be using this version for a long time… This is the newest long term support MariaDB release, and it has finally been marked as stable.

Optimizer: MariaDB 11 introduced important changes to query execution self-optimization, 11.4 not only incorporates the latest fine-tuning to the Optimizer, it is also the first long-term support release incorporating this new engine.
An interesting change was introduced in the way dates are optimized, with great impact in queries using dates, potentially a major improvement for Mautic performance.

Mautic 5.1.0 Andromeda!

Mautic 5.1 is one of the largest releases ever, in terms of how many PRs it incorporates.
Tons of fixes, tons of new features, and the first improvements to the UI we have had in a very long time.
It probably also contains tons of bugs, hence I would not yet use this version in production. This package version will obviously be changing a lot in the upcoming months, I’ll keep updating this article whenever new versions are released.

Step 1: Install the packages required to run Mautic 5.

Let’s get started installing Mautic 5 on our VPS, first log in to your VPS and gain sudo privileges so you have the rights to issue all the commands:

sudo su

Now make sure your server is up-to-date by updating Ubuntu.

apt update && apt upgrade -y

Install all the required packages (applications) that are needed to run Mautic.

First, we will add the ondrej php and apache2 repositories for Ubuntu, because we want to use the most updated versions of the packages.
We will also add the repository for the newer MariaDB release.

apt install software-properties-common apt-transport-https -y

add-apt-repository ppa:ondrej/php

add-apt-repository ppa:ondrej/apache2

curl -fsSL http://mirror.mariadb.org/PublicKey_v2 | sudo gpg --dearmor | sudo tee /usr/share/keyrings/mariadb.gpg > /dev/null

echo "deb [arch=amd64,arm64,ppc64el signed-by=/usr/share/keyrings/mariadb.gpg] http://mirror.mariadb.org/repo/11.4/ubuntu/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/mariadb.list

Let’s update the system one more time:
apt update && apt upgrade -y && apt autoremove -y

We are now ready to install all the required packages:

apt install apache2 mariadb-server unzip libapache2-mod-php8.2 php8.2 php8.2-{xml,mysql,imap,zip,intl,curl,gd,mbstring,bcmath} -y

Activate any Apache 2 modules that are not active by default after installation, and we also enable the newly installed PHP 8.2
a2enmod php8.2 rewrite expires headers http2 ssl actions alias

Configure Apache:

wget https://files.mktg.dev/install-mautic/m5-tuto-basic.conf.txt -O /etc/apache2/sites-available/000-default.conf

Configure PHP
update-alternatives --set php /usr/bin/php8.2

sed -i 's/memory_limit = 128M/memory_limit = 512M/' /etc/php/8.2/apache2/php.ini
sed -i 's/post_max_size = 8M/post_max_size = 32M/' /etc/php/8.2/apache2/php.ini
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 32M/' /etc/php/8.2/apache2/php.ini
sed -i 's/max_execution_time = 30/max_execution_time = 60/' /etc/php/8.2/apache2/php.ini
sed -i 's/;date.timezone =/date.timezone = UTC/' /etc/php/8.2/apache2/php.ini
cp /etc/php/8.2/apache2/php.ini /etc/php/8.2/cli/php.ini

Create a database for Mautic.
/usr/bin/mariadb -u root 

This command will connect you to your database, the only difference you will notice is that the text before your command prompt will change to “MariaDB [(none)]>”

MariaDB [(none)]> CREATE DATABASE mautic DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
MariaDB [(none)]> GRANT ALL ON mautic.* TO 'root'@'localhost' IDENTIFIED BY 'password';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

After the “EXIT;” command, you will return to the normal cli / bash mode…

Step 2: Install Mautic 5.1.0

cd /var/www/html
wget https://github.com/mautic/mautic/releases/download/5.1.0/5.1.0.zip
unzip 5.1.0.zip
rm 5.1.0.zip

Make sure Apache and Mautic, have ownership and write access to the files.

find /var/www/html -type d -exec chmod 755 -- {} +; find /var/www/html -type f -exec chmod 644 -- {} +; chown -R www-data:www-data /var/www/html

Almost done, let’s reload Apache configuration to apply our changes.

service apache2 restart

sudo -u www-data php /var/www/html/bin/console cache:clear

OK, so your new Mautic 5.0 Installation is now completed, now you just need to run the Installation Wizard:

Step 3: Run the Mautic 5 Configuration Wizard.

Mautic 5 is now ready to be configured, you just need to use a browser, like Chrome or Firefox, and navigate to the IP of your server, preceded with http://

 Here’s an excerpt of your configuration for the Mautic Installation Wizard

  • Database driver: MySQL PDO
  • Database Host: localhost
  • Database port: 3306
  • DB name: mautic
  • Database Table Prefix: Leave empty
  • DB User: root
  • DB Password: password
  • Backup existing tables: No

If you need help with the wizard steps, check this other post with very detailed step-by-step instructions for each of the screens: Mautic Installation: The Configuration Wizard

Step 4: Install the Mautic 5 Cron Jobs.

Mautic is now already installed, and you can navigate to all the sections and explore, but if you want working segments and campaigns you will also need to install the Mautic cron jobs.

wget https://files.mktg.dev/install-mautic/mautic5-cron-jobs.txt

crontab mautic5-cron-jobs.txt

If you want to know more about Mautic 5 cron jobs, you can check these other posts:

Mautic cron jobs for dummies & marketers.
Mautic Cron Jobs: Which Ones to Use.

Got any questions? Got stuck on one of the steps? Anything not working as described in the tutorial? Go ahead and ask in the comments here below!!

And if you want to further advance and improve your Mautic Installation, check this other, more advanced, Mautic Installation guide:
Secure Mautic Installation on a VPS.

Yosu Cadilla

My name is Yosu Cadilla, a Systems Administrator since year 2000.
I discovered Mautic in 2017 and since have specialized in:
– Running Mautic for Marketing Agencies.
– Running very large Mautic instances
with millions of contacts.

If you are planning on deploying Mautic for your Marketing Agency, or you have a large Mautic Instance…
Let’s have a chat!  yosu.cadilla@gmail.com