How to Install Mautic with EasyEngine on Ubuntu 16.04

install mautic

In this article, you will learn to install Mautic, an open-source marketing automation tool. Part of the setup process will use Easy Engine to automate the deployment a LAMP stack.

You can use Mautic to create leads, manage online marketing campaigns and landing pages.

Before getting started you will need a cloud server instance as this tutorial is oriented towards a production-ready publicly available setup and some steps will require also access to a DNS panel to setup your domain settings (how to set up your public domain settings is not covered here).

You can start with a VPS that meets the following requirements:

- Ubuntu 16.04.03 64 bits or latest available
- 1 CPU
- 2 GB RAM
- 30 GB Hard drive

1. Check the system version

a. Log into your server and make sure the system is up-to-date.

ssh root@yourserverip
lsb_release -a


  root@newvps:~# lsb_release -a
  No LSB modules are available.
  Distributor ID:    Ubuntu
  Description:    Ubuntu 16.04.3 LTS
  Release:    16.04
  Codename:    xenial

b. Run a system update if necessary to install the latest system patches and upgrades.

apt update && apt upgrade -y

2. Check your DNS configuration

a. Make sure that your DNS settings are correct with one A record pointing to your server IP and a "www" subdomain in a CNAME record pointing to your domain.



  user@workstation:~$ dig
  ; <> DiG 9.9.5-9+deb8u14-Debian <>
  ;; global options: +cmd
  ;; Got answer:
  ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9405
  ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
  ;        IN    A
  ;; ANSWER SECTION:    300    IN    CNAME    60    IN    A    yourserverip
  ;; Query time: 96 msec
  ;; SERVER:
  ;; WHEN: Sat Sep 16 03:56:05 CST 2017
  ;; MSG SIZE  rcvd: 68

3. Setup the name of your VPS to match your domain

a. Modify the DNS files for Ubuntu as root.

ssh root@yourserverip
sudo -i
cp -av /etc/hostname /etc/hostname.orig
cp -av /etc/hosts /etc/hosts.orig
echo "" > /etc/hostname
echo -e "\nyourserverip          yoursitedomain" >> /etc/hosts

b. Reboot the new instance with the new DNS setting and get back in, the new configuration should be working already.

ssh root@yourserverip

4. Prepare the application deployment with Easy Engine

a. Install Easy Engine using the command line below as root.

sudo -i
wget -qO ee && sudo bash ee

b. Use Easy Engine to deploy MySQL, NGINX, and PHP on the server, including the support for Let's Encrypt.

ee site create --mysql --letsencrypt


  root@yoursitedomain:~# ee site create --mysql --letsencrypt
  Adding repository for MySQL, please wait...
  Adding repository for NGINX, please wait...
  Adding repository for PHP, please wait...
  Updating apt-cache, please wait...
  Installing packages, please wait...
  Downloading MySQLTuner           [Done]
  Reload : postfix   [OK]
  Reload : nginx     [OK]
  Restart : php5.6-fpm[OK]
  Reload : mysql     [OK]
  Running pre-update checks, please wait...
  Setting up NGINX configuration     [Done]
  Setting up webroot         [Done]
  Setting up database        [Done]
  Reload : nginx     [OK]
  HTTP Auth User Name: easyengine
  HTTP Auth Password : 4ZOQc2
  Successfully created site
  Letsencrypt is currently in beta phase. 
  Do you wish to enable SSl now for
  Type "y" to continue [n]:y
  Please Wait while we fetch SSL Certificate for your site.
  It may take time depending upon network.
  Let's Encrypt successfully setup for your site
  Your certificate and chain have been saved at /etc/letsencrypt/live/
  Configuring Nginx SSL configuration
  Adding /var/www/
  Adding /etc/nginx/conf.d/
  Added HTTPS Force Redirection for Site
  Creating Cron Job for cert auto-renewal
  Reload : nginx     [OK]
  Congratulations! Successfully Configured SSl for Site
  Your cert will expire within 89 days.

5. Download and Install Mautic

a. Download the Mautic sources from GitHub with the web directory for the application.

cd /var/www/
rm -rf htdocs
mv mautic-master htdocs
cd htdocs

b. Download and Install PHP Composer to complete the installation process.

apt -y install curl
curl -s | php
mv -v composer.phar /usr/local/bin/composer
composer install
cd ..
chown -R www-data: htdocs

6. Tune PHP, MySQL and Nginx to work with your Mautic application

a. Get the root password for your MySQL server.

cat /etc/mysql/conf.d/my.cnf

b. Access your MySQL server and create the user and database for Mautic.

mysql -uroot -p
CREATE DATABASE mautic_data;
CREATE USER 'mautic_user'@'localhost' IDENTIFIED BY 'RRl4$3W7fvpdKd#OVNV';
GRANT ALL PRIVILEGES ON  mautic_data.* TO 'mautic_user'@'localhost';


  root@yoursitedomain:/var/www/ mysql -uroot -p
  Enter password: 
  Welcome to the MariaDB monitor.  Commands end with ; or \g.
  Your MariaDB connection id is 27
  Server version: 10.1.26-MariaDB-1~xenial binary distribution
  Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
  Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  MariaDB [(none)]> CREATE DATABASE mautic_data;
  Query OK, 1 row affected (0.00 sec)
  MariaDB [(none)]> CREATE USER 'mautic_user'@'localhost' IDENTIFIED BY 'RRl4$3W7fvpdKd#OVNV';
  Query OK, 0 rows affected (0.00 sec)
  MariaDB [(none)]> GRANT ALL PRIVILEGES ON  mautic_data.* TO 'mautic_user'@'localhost';
  Query OK, 0 rows affected (0.00 sec)
  MariaDB [(none)]> quit

c. Update the PHP configuration for the PHP FastCGI.

sed -i "47ialways_populate_raw_post_data = -1" /etc/php/5.6/fpm/php.ini

d. Update the Nginx Configuration to fix a problem with Mautic accessing its assets when a redirect to the SSL site version is enabled.

cat "rewrite ^/index.php/(.*)$ /$1 last;" > /var/www/

e. Make sure to change the file ownership are setup correctly.

chown www-data: /var/www/

f. Restart the PHP FastCGI and Nginx services.

service php5.6-fpm restart
systemctl restart nginx

7. Run the Mautic setup wizard

a. Open a browser and enter this URL: to start the configuration wizard.

b. During the setup make sure to enter your database settings, as in the box below:

Database Settings

user : mautic_user
pass : RRl4$3W7fvpdKd#OVNV
db : mautic_data

c. Setup an admin user and password for the application ( they shouldn't be same as your database user and password )

Mautic Administrator

user: mautic-admin
pass: F1e#vQueb+Jouwegibyu

d. Once the setup wizard as finished, go back to the server console and add these cronjobs.

# Setting up Mautic cron jobs,
# please refer to for further details

# Updating Contact Segments
0,15,30,45  * * * *  /usr/bin/php /var/www/ mautic:segments:update

# Campaign Updates
5,20,35,50  * * * *  /usr/bin/php /var/www/ mautic:campaigns:rebuild

# Email Delivery
10,25,40,55 * * * *  /usr/bin/php /var/www/ mautic:emails:send

c. Download and deploy the IP Lookup library to finish the setup of mautic.

php /var/www/ mautic:iplookup:download
chown -R www-data: /var/www/
service php5.6-fpm restart
systemctl restart nginx

At this point, you should have your Mautic server up and running, so I recommend getting started with the site official documentation to learn how to setup your campaigns and create landing pages for your eCommerce site.

3 Comments... add one

Leave a Comment