How To Install Mautic 3 Email Marketing System [Updated Step by Step Guide)

Image for post
Image for post

What is Mautic?

Mautic is an open-source, marketing automation system and mostly used as a self-hosted email marketing solution.

What do we mean by a self-hosted email marketing solution?

As I explained in my Email Marketing Definitive Technical Guide,

  • The Management Application, where you can configure and manage your Email Lists, Marketing Campaigns, monitor and analyze results, manage your sending servers, and so on.
Image for post
Image for post

Mautic Installation

What is required to Setup Mautic?

What you need is simply is:

  • Domain Name to use with our setup.

Get a Domain Name.

Getting a Domain is as simple as eating a piece of chocolate cake. you need to go to any Domain registrar company like Godaddy, Enom, Freenom, Namecheap…. and Buy a Domain Name, you can even get one for 1$ per year.

Get a VPS Server.

Now, Let’s get our VPS server to set up Mautic on.

What company should I use?

You can use whatever company you want to buy a VPS Server, in this guide I will be using Contabo services.

  • You can start with 1 CPU/ 1 GB RAM (and you can resize later).

Point Domain to VPS.

Before we continue you need to point your domain or subdomain to your VPS IP address.

Step 1: Install Apache2 Web Server on Ubuntu

Run the commands below to Install Apache Web Server on your VPS Server.

sudo apt update
sudo apt install apache2
sudo systemctl restart apache2.service
sudo systemctl enable apache2.service
Image for post
Image for post

Step 2: Install MariaDB (MySQL) Database Server

Mautic is like any other PHP System that requires a Database to save data. So we will use the MariaDB Mysql Database system for this purpose.

sudo apt-get install software-properties-common gnupg-curlsudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'sudo add-apt-repository 'deb [arch=amd64,arm64,i386,ppc64el] http://mirrors.piconets.webwerks.in/mariadb-mirror/repo/10.5/ubuntu xenial main'sudo apt updatesudo apt-get install mariadb-server
sudo apt-get install software-properties-commonsudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://mirrors.piconets.webwerks.in/mariadb-mirror/repo/10.5/ubuntu bionic main'sudo apt updatesudo apt-get install mariadb-server
sudo systemctl stop mysql.service
sudo systemctl start mysql.service
sudo systemctl enable mysql.service
sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service
  • Enter current password for root (enter for none): Just press the Enter
  • Set a root password? [Y/n]: Y
  • New password: Enter your new password (create a secure one)
  • Re-enter new password: Repeat your new password
  • 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
Image for post
Image for post

Step 3: Install PHP and Related Modules

Since Mautic is a PHP based script, we need to install PHP and some modules on our server. I will be installing PHP 7.4 in this guide, but feel free to use any version you want, just change “7.4” to “7.X” in the commands.

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt install php-pcov
Image for post
Image for post
file_uploads = On
allow_url_fopen = On
short_open_tag = On
memory_limit = 256M //You can increase this if you server can handle
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = America/NewYork //Set your Time Zone here
sudo systemctl restart apache2.service

Step 4: Create Mautic Database

Now, we are done installing all the prerequisites and our server is ready for the installation, we need to create a Database for Mautic in MariaDB.

FLUSH PRIVILEGES;
EXIT;

Step 5: Download and Install Mautic.

To get Mautic latest release you may want to use Github repository… Install Composer, Curl, and other dependencies by running the following commands:

#First Command:
sudo apt install curl git
#Second Command:
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer --version=1.10.13
cd /var/www/html
sudo git clone https://github.com/mautic/mautic.git
cd /var/www/html/mauticsudo composer install
sudo chown -R www-data:www-data /var/www/html/mautic/sudo chmod -R 755 /var/www/html/mautic/

Step 6: Configure Apache2 Web Server

Well Done, Now Mautic is installed, we just need to configure apache so we can access Mautic using our domain name. To do so, open WinSCP again and navigate to this directory: /etc/apache2/sites-available/

Image for post
Image for post
<VirtualHost *:80>
ServerAdmin admin@mautic.xmailing.me
DocumentRoot /var/www/html/mautic
ServerName mautic.xmailing.me
ServerAlias mautic.xmailing.me
<Directory /var/www/html/mautic/>
Options +FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Enable mautic configuration in apache and restart the service.

Now simply, run the following commands to finish the setup:

sudo a2ensite mautic.xmailing.me.confsudo a2enmod rewritesudo systemctl restart apache2.service

GREAT! You are almost done

Open your web browser now and navigate to your server name like this:

Image for post
Image for post

Step 7: Configure Cron Jobs

Congratulations! Now we finished the Installation process and Mautic is up and running. we only need to set up the Cron jobs.

What are Cron Jobs?

Simply Cron Jobs are scheduled tasks that run automatically upon a schedule.

#Segments Every 2 Minutes
*/2 * * * * root /usr/bin/php /var/www/html/mautic/bin/console
mautic:segments:update
*/3 * * * * root /usr/bin/php /var/www/html/mautic/bin/console mautic:import
#Campaigns (Every 1 Minute)
* * * * * root /usr/bin/php /var/www/html/mautic/bin/console mautic:campaigns:update
* * * * * root /usr/bin/php /var/www/html/mautic/bin/console
mautic:campaigns:trigger
* * * * * root /usr/bin/php /var/www/html/mautic/bin/console mautic:messages:send
#Process Email Queue Every 5 Minutes
*/5 * * * * root /usr/bin/php /var/www/html/mautic/bin/console mautic:emails:send
#Fetch and Process Monitored Email Every 10 Minutes
*/10 * * * * root /usr/bin/php /var/www/html/mautic/bin/console mautic:email:fetch
#Process Email Queue Every 5 Minutes
*/5 * * * * root /usr/bin/php /var/www/html/mautic/bin/console mautic:emails:send
#Fetch and Process Monitored Email Every 10 Minutes
*/10 * * * * root /usr/bin/php /var/www/html/mautic/bin/console mautic:email:fetch
Image for post
Image for post
Image for post
Image for post

Optional: Secure with a Free SSL.

SSL certificates are used within web servers to encrypt the traffic between the server and client, providing extra security for users accessing your application. Let’s Encrypt provides an easy way to obtain and install trusted certificates for free.

Step 1 — Install the Let’s Encrypt Client

Let’s Encrypt certificates are fetched via client software running on your server. The official client is called Certbot.

sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt install python-certbot-apache

Step 2 — Set Up the SSL Certificate

Generating the SSL certificate for Apache using Certbot is quite straightforward. The client will automatically obtain and install a new SSL certificate that is valid for the domains provided as parameters.

sudo certbot --apache -d mautic.xmailing.me

Full-time writer & I write on Digital Marketing & Online Bussiness Education.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store