How to Install Mautic Marketing Automation Software on Ubuntu 16.04

Mautic is a free and open source marketing automation software that can save time and increase sales. Some of the key features of Mautic:

  • Lead nurturing and tracking
  • marketing campaigns
  • dripflow programs
  • landing pages
  • social media monitoring
  • Mautic can be easily integrated with third-party email services like Gmail, Mandrill, Sendgrid, Amazon SES.
  • and much more

This tutorial is going to show you how to install Mautic marketing automation software on Ubuntu 16.04 VPS or server with Apache, MariaDB/MySQL and PHP7. Nginx config is also provided.


First, I assume that you are comfortable with Linux command line.

It’s also assumed that you have already set up a LAMP stack or LEMP stack on Ubuntu 16.04. If you haven’t already done so, check out the following easy to follow guides.

Once a LAMP or LEMP stack is configured on your Ubuntu 16.04 box, come back here and follow the instructions below.

Step 1: Download Mautic onto Your Ubuntu 16.04 box

If you go to the official website to download Mautic, you are required to enter your name and email address. If that’s not what you like, then download the latest stable version (2.2.1) using the following command.


This file has no extension, but you can know the file type by using the file command.

file latest


latest: Zip archive data, at least v2.0 to extract

So we know it’s a zip file. Use unzip command to unzip it.

sudo apt install unzip

unzip latest -d mautic

A new directory named mautic will be created. Let’s move it to the document root of web server.

sudo mv mautic/ /var/www/

And then let the web server user (www-data) be the owner of this directory.

sudo chown -R www-data:www-data /var/www/mautic/

Step 2: Create a MariaDB/MySQL Database and User for Mautic

Log into MariaDB/MySQL database server. If you are having issues with logging into MariaDB, you might need to disable Unix socket authentication on MariaDB.

mysql -u root -p

Next,create a new database for Mautic using the following command. This tutorial names it mautic, you can use whatever name you like for the database.


The following command will create a database user and password, and at the same time grant all permission of the new database to the new user so later on Mautic can write to the database. Replace red texts with your preferred database name, username and password.

GRANT ALL ON mautic.* TO 'mauticuser'@'localhost' IDENTIFIED BY 'password';

Flush privileges and exit out of database server.



Step 3: Create Apache Virtual Host or Nginx Server Block File for Mautic

If you are using Apache web server, create a virtual host for Mautic.

sudo nano /etc/apache2/sites-available/mautic.conf

Put the following text into the file. Replace the domain name and don’t forget to set an A record for it.

<VirtualHost *:80>

  DocumentRoot /var/www/mautic
  <Directory />
    Options FollowSymLinks
    AllowOverride All

  <Directory /var/www/mautic>
    Options FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all


Save and close the file. Then enable this virtual host with:

sudo a2ensite mautic.conf

Reload Apache for the changes to take effect.

sudo systemctl reload apache2

If you are using Nginx web server, then create a server block file for Mautic. 

sudo nano /etc/nginx/conf.d/mautic.conf

Put the following texts into the file. Replace the domain name.

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

 root /var/www/mautic;
 error_log /var/log/nginx/mautic.error;
 access_log /var/log/nginx/mautic.access;

 index index.php index.html index.htm index.nginx-debian.html;

 location / {
   # try to serve file directly, fallback to app.php
   try_files $uri /index.php$is_args$args;

 location ~ \.php$ {
   include snippets/fastcgi-php.conf;
   fastcgi_pass unix:/run/php/php7.0-fpm.sock;

 location ~* ^/index.php {
   # try_files $uri =404;
   fastcgi_split_path_info ^(.+\.php)(/.+)$;
   # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
   fastcgi_pass unix:/var/run/php/php7.0-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;

Save and close the file. Then test Nginx configuration and reload.

sudo nginx -t

sudo systemctl reload nginx

Step 4: Finish Mautic Installation in Web Browser

Now in your browser address bar, type your domain name for Mautic to access the web install wizard.


If you are seeing a message like below:

install mautic on ubuntu 16.04

then you need to install some PHP extensions with the following command.

sudo apt install php7.0-zip php7.0-xml php7.0-mcrypt php7.0-imap php7.0-intl

Apache users need to reload web server to enable these extensions.

sudo systemctl reload apache2

Nginx users don’t need to reload their web server. Now refresh the install wizard page and click Next Step.

mautic nginx

Enter MariaDB/MySQL database details.

mautic mariadb database

And create an admin user for your Mautic installation

mautic ubuntu 16.04 create admin account

Configure email settings. Note that you have many options in mailer transport. You can use PHP Mail, sendmail, or Gmail or integrate Mautic with third-party email services like Mailjet, Mandrill, Sendgrid, Amazon SES. These settings can always be changed after installation in Mautic configurations page.

mautic email configuration

Once it’s done, you can log into your Mautic marketing automation platform.

Mautic Marketing Automation Software Dashboard

mautic dashboard ubuntu 16.04

If you chose to use sendmail or other SMTP server to send emails to your leads, you may want to check out the following tutorial which shows you how to set up your own email server.

And if 500 internal server error occurred, please check out Mautic logs, which can be found in /web-root-path/app/logs/ directory. After mautic is installed, you may want to check out Mautic getting started guide to add cron jobs, download IP lookup service database and install the tracking JavaScript.

That’s it! I hope this mautic installation guide helped you to install Mautic marketing automation software on Ubuntu 16.04 with LAMP or LEMP. As always, if you found this post useful,  subscribe to our free newsletter or follow us on Google+Twitter or like our Facebook page.

Rate this tutorial
[Total: 15 Average: 4.5]

8 Responses to “How to Install Mautic Marketing Automation Software on Ubuntu 16.04

  • Gabriela
    3 years ago

    Decided to try Mautic after finding out on Try Direct that it can facilitate our marketing campaigns, and help us monitor our social media results. Your tutorial was actually really helpful, wouldn’t know how I would have dealt with installing without it.

  • I am forever stuck in the email part, never finishes after I click the button.

    I’m trying to set up Mautic on my personal computer, everything was fine… until e-mail part.
    I tried all possibilities, none worked, it just say ‘please wait’ forever.

    Any thoughts? Thanks in advance

    • Its me again. I installed IMAP and its working now.
      sudo apt install php7.0-imap
      sudo phpenmod imap
      php -m. Find out imap module
      service apache2 restart

  • Christian
    3 years ago

    HI, this tuto works to install Mautic on Digitl Ocean?

    Thank you,


  • Christian Melo
    3 years ago

    Im using Mailjet to send emails,what you think?

  • Using Nginx on port 80 you should remove /etc/nginx/sites-enabled/default and symlink the mautic vhost.conf like his ln -s /etc/nginx/sites-available/mautic /etc/nginx/sites-enabled/ before restarting nginx otherwise you get the default page and without the symlink the site does also not come up, rest is ok! Tnxs a lot Xiao, kind regards from Holland, Rick

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community ( for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here