Mautic 5 Installation Tutorial: Debian 12, PHP 8.1, MariaDB 11.3
Quote from Yosu Cadilla on May 1, 2024, 21:545 Simple Steps to Install Mautic 5 on Debian 12.
Install the packages required to run Mautic 5. Install Mautic 5.0.4 Run the Mautic 5 configuration wizard. Install the Mautic 5 Cron Jobs. Enjoy your first Mautic 5 installation!I usually do these tutorials for Ubuntu, however, Debian is having a surge in popularity and for good reasons, in fact, in production, I am switching from Ubuntu to Debian, so I thought it was time to add Debian 12 to the Mautic installation tutorials...
With a major code refactoring, a new Symfony 6 under the hood and an intensive fat reduction treatment, Mautic 5 is as lean and mean as it gets.
This is an early release and, in my opinion, not yet ready for production, but the promise of a new level of stability and performance makes it very enticing to install Mautic 5 and give it a spin (surprise, surprise, it is faster and feels more streamlined than Mautic 4).
But wait, there's more! With PHP 8.1 support and MariaDB 11.3, your Mautic will run faster, and your database will self optimize better than ever before.
So here's, as always, the best possible specs for your new Mautic 5 installation! Start your Mautic 5 venture with the right foot!Should I use Mautic 4 in production 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 go for the stable and reliable Mautic 4 instead, because it is:
- Well tested, very stable, no bugs.
- Existing bugs in M4 are known and already fixed in Mautic 4.4.11.
- 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!
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 VPSIf 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 simple 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 Mautic setups.What all this means is very reduced chanced of hitting a bug or compatibility issue with this setup, but if you do hit a bug, post in the comments below and we'll try to help you.
Step 1: Install the packages required to run Mautic 5.
Let’s get started installing Mautic 5 on our VPS, first log in to the VPS… 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 the Debian 12 OS.
apt update && apt upgrade -y
Before we install all the required packages (applications) that are needed to run Mautic, we will add the https://deb.sury.org/ PHP repository, because we want to use updated versions of the packages.
In order to do so, we will need a few packages first:
apt install lsb-release ca-certificates wget ntp apt-transport-https curl nano unzip
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
And also the repositories for the latest Maria DB stable versions:
echo "deb [signed-by=/usr/share/keyrings/mariadb-keyring.pgp]
https://deb.mariadb.org/11.3/debian `lsb_release -cs` main" | sudo tee /etc/apt/sources.list.d/mariadb.list
#curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=11.3
apt update && apt upgrade -y
Now we are finally ready to install all the required packages:
apt install apache2 mariadb-server libapache2-mod-php8.1 php8.1 php8.1-{xml,mysql,imap,zip,intl,curl,gd,mbstring,bcmath} -y
Activate any required Apache modules that are not active by default after installationa2enmod
proxy_fcgi setenvif rewrite expires headers http2 ssl actions aliasAnd we also enable the newly installed PHP 8.1
a2enconf php8.1-fpm
Now we force PHP-CLI to the version we want to use for Mautic
update-alternatives --set php /usr/bin/php8.1
php -vsystemctl reload apache2
systemctl status php8.1-fpmsudo -u www-data php /var/www/html/bin/console cache:clear
rm -R /var/www/html/var/cacheConfigure Apache:
wget https://mauteam.org/wp-content/uploads/2019/10/000-default.txt -O /etc/apache2/sites-available/000-default.conf
?? rm 000-default.txt
Create a database for Mautic.
mysql -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 mode…
Configure PHP
nano /etc/php/8.1/fpm/php.ini
cp /etc/php/8.1/fpm/php.ini /etc/php/8.1/cli/php.ini
service apache2 restart
nano /etc/php/8.1/fpm/php.iniConfigure MariaDB
nano nano /etc/mysql/mariadb.conf.d/50-server.cnf
service mariadb restart
sudo systemctl status mariadbreboot
Step 2: Install Mautic 5.0.4
cd /var/www/html
wget https://github.com/mautic/mautic/releases/download/5.0.4/5.0.4.zip
unzip 5.0.4.zip
rm 5.0.4.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 reload
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: NoIf 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://mauteam.org/wp-content/uploads/2019/10/cron-jobs.txt
crontab 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.If you were successful installing Mautic please write Yes! or Successful! in the comments below.
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.
5 Simple Steps to Install Mautic 5 on Debian 12.
-
Install the packages required to run Mautic 5.
-
Install Mautic 5.0.4
-
Run the Mautic 5 configuration wizard.
-
Install the Mautic 5 Cron Jobs.
-
Enjoy your first Mautic 5 installation!
I usually do these tutorials for Ubuntu, however, Debian is having a surge in popularity and for good reasons, in fact, in production, I am switching from Ubuntu to Debian, so I thought it was time to add Debian 12 to the Mautic installation tutorials...
With a major code refactoring, a new Symfony 6 under the hood and an intensive fat reduction treatment, Mautic 5 is as lean and mean as it gets.
This is an early release and, in my opinion, not yet ready for production, but the promise of a new level of stability and performance makes it very enticing to install Mautic 5 and give it a spin (surprise, surprise, it is faster and feels more streamlined than Mautic 4).
But wait, there's more! With PHP 8.1 support and MariaDB 11.3, your Mautic will run faster, and your database will self optimize better than ever before.
So here's, as always, the best possible specs for your new Mautic 5 installation! Start your Mautic 5 venture with the right foot!
Should I use Mautic 4 in production 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 go for the stable and reliable Mautic 4 instead, because it is:
- Well tested, very stable, no bugs.
- Existing bugs in M4 are known and already fixed in Mautic 4.4.11.
- 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!
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
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 simple 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 Mautic setups.
What all this means is very reduced chanced of hitting a bug or compatibility issue with this setup, but if you do hit a bug, post in the comments below and we'll try to help you.
Step 1: Install the packages required to run Mautic 5.
Let’s get started installing Mautic 5 on our VPS, first log in to the VPS… 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 the Debian 12 OS.
apt update && apt upgrade -y
Before we install all the required packages (applications) that are needed to run Mautic, we will add the https://deb.sury.org/ PHP repository, because we want to use updated versions of the packages.
In order to do so, we will need a few packages first:
apt install lsb-release ca-certificates wget ntp apt-transport-https curl nano unzip
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
And also the repositories for the latest Maria DB stable versions:
echo "deb [signed-by=/usr/share/keyrings/mariadb-keyring.pgp]
https://deb.mariadb.org/11.3/debian `lsb_release -cs` main" | sudo tee /etc/apt/sources.list.d/mariadb.list
# curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=11.3
apt update && apt upgrade -y
Now we are finally ready to install all the required packages:
apt install apache2 mariadb-server libapache2-mod-php8.1 php8.1 php8.1-{xml,mysql,imap,zip,intl,curl,gd,mbstring,bcmath} -y
Activate any required Apache modules that are not active by default after installationa2enmod
proxy_fcgi setenvif rewrite expires headers http2 ssl actions alias
And we also enable the newly installed PHP 8.1
a2enconf php8.1-fpm
Now we force PHP-CLI to the version we want to use for Mautic
update-alternatives --set php /usr/bin/php8.1
php -v
systemctl reload apache2
systemctl status php8.1-fpm
sudo -u www-data php /var/www/html/bin/console cache:clear
rm -R /var/www/html/var/cache
Configure Apache:
wget https://mauteam.org/wp-content/uploads/2019/10/000-default.txt -O /etc/apache2/sites-available/000-default.conf
?? rm 000-default.txt
Create a database for Mautic.mysql -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 mode…
Configure PHP
nano /etc/php/8.1/fpm/php.ini
cp /etc/php/8.1/fpm/php.ini /etc/php/8.1/cli/php.ini
service apache2 restart
nano /etc/php/8.1/fpm/php.ini
Configure MariaDB
nano nano /etc/mysql/mariadb.conf.d/50-server.cnf
service mariadb restart
sudo systemctl status mariadb
reboot
Step 2: Install Mautic 5.0.4
cd /var/www/html
wget https://github.com/mautic/mautic/releases/download/5.0.4/5.0.4.zip
unzip 5.0.4.zip
rm 5.0.4.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 reload
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://mauteam.org/wp-content/uploads/2019/10/cron-jobs.txt
crontab 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.
If you were successful installing Mautic please write Yes! or Successful! in the comments below.
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.