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.

Prerequisites

First, I assume that you are comfortable with working 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.

wget https://www.mautic.org/download/latest

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

file latest

Output:

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.

CREATE DATABASE mautic DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

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.

FLUSH PRIVILEGES;

EXIT

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 email address and domain name.

<VirtualHost *:80>
  ServerAdmin [email protected]
  ServerName mautic.your-domain.com

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

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

</VirtualHost>

Save and close the file. Then create the symlink.

sudo ln -s /etc/apache2/sites-available/mautic.conf /etc/apache2/sites-enabled/

Reload Apache.

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;
 server_name mautic.your-domain.com;

 root /var/www/mautic;

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

 location / {
   # First attempt to serve request as file, then
   # as directory, then fall back to displaying a 404.
   try_files $uri $uri/ =404;
 }

 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.

mautic.your-domain.com

or

mautic.your-domain.com/index.php/installer

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 option in mailer transport. You can use PHP Mail, sendmail, or Gmail or integrate Mautic with third-party email services like Mandrill, Sendgrid, Amazon SES.

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 to send emails to your leads, you may want to check out the following tutorial which shows you how to set up a Postfix SMTP server.

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: 4 Average: 4.3]