How to Install Mautic Marketing Automation Tool on CentOS 7

Mautic is an open source and self-hosted marketing automation tool for everyone. It allows you to grow up your business, monitor your website, create landing pages, create campaigns for your business, manage contacts, and send marketing emails.

In this tutorial, I will show you step-by-step how to install Mautic Marketing Automation Platform on CentOS 7. It's a web-based application, and we will be using the LEMP (Linux, Nginx, MySQL/MariaDB, PHP) stack for our installation guide.


  • CentOS 7 server
  • Root privileges

What we will do

  1. Install EPEL Repository
  2. Install Nginx Webserver
  3. Install and Configure MariaDB
  4. Install and Configure PHP-FPM
  5. Download Mautic
  6. Configure Nginx Virtual Host for Mautic
  7. Mautic Web-based Installation

Step 1 - Install EPEL Repository

The first thing we must do is to add new EPEL repository to the system.

Add new EPEL repository to the CentOS 7 system using the following command.

yum -y install epel-release

New EPEL repository has been installed and added to the system.

Step 2 - Install Nginx

Install the Nginx web server from the EPEL repository using the following yum command.

yum -y install nginx

After the installation is complete, start the service and enable it to launch at system boot.

systemctl start nginx
systemctl enable nginx

Now check it using the netstat command.

netstat -plntu

And make sure you get the result as shown below.

Check if nginx is working with the netstat command

Step 3 - Install and Configure MariaDB

Mautic offers support only for the MySQL database with min version 5.5.3. For this guide, we will be using the mariadb-server 10.0 based on MySQL 5.5.

Install the mariadb database using the yum command below.

yum -y install mariadb-server

After the installation is complete, start the mariadb service and enable it to launch at boot time.

systemctl start mariadb
systemctl enable mariadb

For security reasons, we need to configure the mysql root password.

Run the 'mysql_secure_installation' command as shown below.


And you will be asked about some mysql configuration - see below.

Set root password? [Y/n] Y
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

The MariaDB installation has been completed.

Next, we need to add new database and user for the Mautic installation. We will create a new database named 'mautic' with user 'mauticuser' and password 'aqwe123'.

Login to the mysql server using the myql command.

mysql -u root -p

Now create new database and user using the mysql queries below.

create database mautic;
grant all on mautic.* to 'mauticuser'@'localhost' IDENTIFIED BY 'aqwe123';
flush privileges;

Create mautic database

The MySQL database and user for mautic installation has been created.

Step 4 - Install and Configure PHP-FPM

Mautic requires PHP 5.6.19 (at-least) for installation. And for this guide, we will be using PHP-FPM 7.0 from the 'webtatic' repository.

Add new 'webtatic' repository for PHP 7.

rpm -Uvh

Now install PHP and PHP-FPM with all required extensions using the following yum command.

yum -y install php70w-fpm php70w-mbstring php70w-xml php70w-mysql php70w-common php70w-gd php70w-json php70w-cli php70w-curl php70w-zip php70w-xml php70w-mcrypt php70w-imap php70w-intl php70w-process

PHP and PHP-FPM with all required extensions have been installed. Next, we need to configure PHP and PHP-FPM.

For this, we need to edit the 'php.ini' file and edit the php-fpm pool configuration file 'www.conf'.

Edit the 'php.ini' file using vim editor.

vim /etc/php.ini

Uncomment the 'date.timezone' line and set the default time zone to 'UTC'.

date.timezone = "UTC"

Uncomment the 'cgi.fix_pathinfo' line and change the value to '0'.

cgi.fix_pathinfo = 0

For the PHP session path configuration, uncomment the 'session.save_path' line and change it to the '/var/lib/php/session' directory as below.

session.save_path = "/var/lib/php/session"

Save these changes and exit the editor.

Now, edit the PHP-FPM pool configuration file 'www.conf' using vim.

vim /etc/php-fpm.d/www.conf

Change the default user and group for PHP-FPM to the 'nginx' user.

user = nginx
group = nginx

Instead of using the system port, PHP-FPM will be running under the sock file. Change the 'listen' line as shown below.

listen = /var/run/php-fpm/php-fpm.sock

Now set the owner of the sock file to the 'nginx' user with permission '660'.

listen.owner = nginx = nginx
listen.mode = 0660

That's it for this file. Save and exit.

Next, create a new directory for the PHP session file and change the owner to the 'nginx' user.

mkdir -p /var/lib/php/session/
chown -R nginx:nginx /var/lib/php/session/

Now start the php-fpm service and enable it to launch at system boot.

systemctl start php-fpm
systemctl enable php-fpm

PHP and PHP-FPM have been installed, and the latter is running under the sock file.

Check it using the netstat command below.

netstat -pl | grep php-fpm.sock

And you should get the result as below.

Configure PHP

Step 5 - Download Mautic

Create a new directory '/var/www' and enter it.

mkdir -p /var/www
cd /var/www/

Now download the mautic source code using wget, then extract it to the 'mautic' directory using the unzip command.

unzip latest -d mautic/

Note: If you get a result saying 'unzip command not found', install the package using the following yum command.

yum -y install unzip

Now change the ownership for 'mautic' directory to the 'nginx' user and group.

sudo chown -R nginx:nginx mautic/

Mautic source code has been downloaded, and the '/var/www/mautic' directory will be the webroot directory for mautic.

Step 6 - Configure Nginx Virtual Host for Mautic

For this guide, we're using Nginx instead of Apache web server. In this step, we will configure the Nginx virtual host for our mautic installation on the CentOS 7 system.

Goto the '/etc/nginx' directory and create a new file named 'mautic.conf' under the 'conf.d' directory using the vim editor.

cd /etc/nginx/
vim conf.d/mautic.conf

Paste the following Nginx virtual host configuration there.

server {
    listen 80;
    listen [::]:80;

    root /var/www/mautic;
    index index.php index.html index.htm index.nginx-debian.html;

    location / {
      try_files $uri $uri/ =404;

    location ~ .php$ {
      include fastcgi.conf;
      fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;

    location ~* ^/index.php {
      fastcgi_split_path_info ^(.+.php)(/.+)$;
      fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include fastcgi_params;
      fastcgi_buffer_size 128k;
      fastcgi_buffers 256 16k;
      fastcgi_busy_buffers_size 256k;
      fastcgi_temp_file_write_size 256k;

That's it. Save and exit.

Now test the nginx configuration and make sure there is no error. Then restart the nginx service.

nginx -t
systemctl restart nginx

Nginx virtual host configuration for mautic has been completed.

Configure Nginx, test and apply the config

Step 7 - Mautic Web-based installation

Open your web browser and visit the mautic domain name, mine is:

You will be redirected to the mautic installation page. There, make sure all the extensions and configuration has no error.

Mautic web installer

Click the 'Next Step' button to continue.

Now you will see the page about the database configuration.

Type your database name, database user, and password as below.

Set the database details for Mautic

And click the 'Next Step' button.

Next, we need to create a new admin account for Mautic.

Type your admin user, email, and password.

Add a admin user

Click 'Next Step' button.

Next up is the email configuration - you can choose one option, or you can do this configuration later.

Email configuration

Click the 'Next Step' button again.

Now, you will get the admin login page.

Type your admin user and password and click the 'Login' button.

Login to Mautic

You'll be taken to the Mautic admin dashboard as shown below.

Mautic Marketing Automation Tool

The Mautic marketing automation tool installation on CentOS 7 with Nginx web server has been completed successfully.


Share this page:

2 Comment(s)

Add comment

Please register in our forum first to comment.


By: Zimny's Brain

Preaty good manual,

Great if you can do it in secure envy (ssl). I understand that you prefere NGINX but what about Apache man page?

Self signed SSL give me a pain maybe you get some good way to go.

By: Aditya Duggal


Thanks for an excellent tutorial. I have tried to follow your tutorial but I am still facing issues in getting my site up and running. The problem it seems is that the mautic.conf file has small issue in your tutorial there is a line `include fastcgi.conf`

I basically had to comment out that line since there was an error with the conf file with nginx -t. 

This is the error: nginx: [emerg] invalid number of arguments in "include" directive in /etc/nginx/conf.d/mautic.conf:15

I think because of that I am unable to run mautic on my server. It would be great if you could include the guide to show what to do if we get such error.