Ubuntu 20.04 Server Install Mautic Self-hosted Email Marketing Platform


    This tutorial can be displaying you tips on how to arrange Mautic electronic mail advertising platform on Ubuntu 20.04 with Apache or Nginx net server. Mautic is a free open supply various to business electronic mail service suppliers like MailChimp. Key options of Mautic contains:

    • Lead nurturing and monitoring
    • Advertising campaigns
    • Dripflow packages
    • Create Touchdown pages
    • Social media monitoring
    • Set up free plugins to increase the performance of Mautic.
    • Mautic could be simply built-in with third-party SMTP relay providers like Gmail, Mandrill, Sendgrid, Amazon SES. You too can use your personal mail server.
    • and far more

    Install Mautic Self-Hosted Email Marketing Platform on Ubuntu 20.04 Server

    Advantages of Self Internet hosting Electronic mail Advertising Platform

    Why do you wish to self-host electronic mail advertising platform as an alternative of utilizing third-party ESPs (Electronic mail Service Supplier) like MailChimp?

    For starters, self-hosting can prevent some huge cash. Mautic is free and open-source software program. You solely have to pay $8.99/month for the VPS (digital non-public server), which may run a full-featured mail server and the Mautic electronic mail advertising platform. It may well simply deal with tens of millions of subscribers. So your complete value is all the time $8.99/month regardless of what number of subscribers you will have. When you personal tens of millions of subscribers on MailChimp, the associated fee can be hundreds of {dollars} per thirty days.

    One more reason is that Firefox browser blocks third-party trackers by default, so the MailChimp signup widget in your web site doesn’t work correctly and the MailChimp pop-up gained’t proven to your guests. By internet hosting the e-mail advertising platform below your personal area title, Firefox doesn’t block the tracker, so your signup widget or popup can work correctly. That is additionally true if customers of different net browsers resolve to dam third-party trackers.

    As well as, you’ll be able to manipulate subscribers’ info from the database and even automate it with a Cron job. For instance, I usually see there are typos when a customer enters info on the sign-up kind. I take advantage of a cron job to robotically right some frequent typos.

    Final however not least, self-hosting can defend your freedom of speech. You by no means want to fret about an electronic mail service supplier closing your account like Mailchimp did.

    Challenges of Self Internet hosting Electronic mail Advertising Platform

    The primary drawback you face is discovering a superb self-hostable electronic mail advertising platform. Beforehand we have now mentioned tips on how to arrange Mailtrain, which is an open-source various to MailChimp, on Ubuntu 20.04 server. Nevertheless, Mailtrain is lacking a number of contains a typical web site proprietor wish to have.

    • Mailtrain doesn’t present customers with a straightforward method to insert signup widget or popup on the web site.
    • Customers can’t set time schedule for RSS campaigns.
    • No contact score.

    In any case, Mailtrain is only a undertaking of a handful of software program builders.

    Mautic, however, is a undertaking of a crew of builders and has developed increasingly options through the years. You do have a straightforward method to insert signup widget and popup in your web site with Mautic. There’s additionally a vibrant and really energetic group round it. Moreover, Mautic is greater than only a publication/electronic mail advertising platform. It’s a full-blown digital expertise platform, as they name it. With Acquia (which is an organization providing paid service for the Drupal open supply content material administration system) buying Mautic in Might 2019, the long run for Mautic has by no means been brighter. So I really feel it’s time to modify from Mailtrain to Mautic.

    The second problem is to have the technical experience to arrange the e-mail advertising platform by yourself server. Don’t fear, I’ll present you ways in just some moments.

    The third problem is that it’s essential have a superb popularity for the IP deal with of your mail server and your area title as effectively. In any other case, your emails will land within the spam folder. Gmail Postmaster Instruments can present you if in case you have a superb popularity in your area title and IP deal with. As you’ll be able to see from the screenshot under, I all the time have excessive area popularity with Gmail, as a result of I all the time comply with finest practices to ship emails to my subscribers. It’s very uncommon that my subscribers report my electronic mail as spam.


    To ship out bulk emails, it’s essential comply with these guidelines or practices.

    1. Ensure that the recipient gave you permission to ship electronic mail. Use double opt-in to confirm the subscriber’s electronic mail deal with.
    2. Don’t ship chilly emails to hundreds of people that have by no means acquired emails from you earlier than. As a substitute, it’s essential heat up your IP deal with. For instance, ship 500 emails on day 1, then ship 1000 emails on day 2, ship 2000 emails on day 3.
    3. Embody your contact info and your mailing deal with on the backside of the e-mail message.
    4. Personalize the e-mail message as a lot as attainable. For instance, embrace the recipient’s title within the electronic mail.
    5. Conform to CAN-SPAM Act
    6. Keep away from giant attachments.
    7. Clear your electronic mail record. For instance, delete electronic mail subscribers that haven’t opened your electronic mail within the final 30 days.
    8. Get authorized as Return Path Licensed Sender.
    9. Check your electronic mail placement with GlockApps.

    It’s additionally extremely beneficial to enhance your IP/area popularity earlier than sending bulk emails. Now let’s have a look at tips on how to set up Mautic on Ubuntu 20.04 server.

    Stipulations of putting in Mautic on Ubuntu 20.04 Server

    When you don’t have your personal mail server but, I like to recommend utilizing the free iRedMail program to shortly arrange your personal mail server earlier than putting in Mautic, so that you don’t must spend cash on business SMTP relay service.

    Mautic is written in PHP and depends on MySQL/MariaDB database server. So it’s essential arrange a LAMP stack or LEMP stack. When you favor Apache net server, then arrange LAMP stack.

    When you favor Nginx net server, then arrange LEMP stack.

    Be aware that iRedMail will robotically arrange a LEMP stack for you, so if you’ll set up Mautic in your iRedMail server, you don’t have to arrange LEMP stack once more.

    You additionally want a site title. I registered my area title from NameCheap as a result of the worth is low they usually give whois privateness safety free for all times. With out additional ado, let’s set up Mautic on Ubuntu 20.04 server.

    Step 1: Obtain Mautic onto Your Ubuntu 20.04 Server

    When you go to the official web site to obtain Mautic, you’re required to enter your title and electronic mail deal with. If that’s not what you want, then obtain the newest steady model by executing the next command in your server.


    The file can be saved as newest. Use unzip command to unzip it to /var/www/mautic/ listing.

    sudo apt set up unzip

    sudo unzip newest -d /var/www/mautic/

    Then make the net server consumer (www-data) because the proprietor of this listing.

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

    Step 2: Create a MariaDB Database and Consumer for Mautic

    Log in to MariaDB console.

    sudo mysql -u root

    Subsequent, create a brand new database for Mautic utilizing the next command. This tutorial names it mautic, you should utilize no matter title you want for the database.


    The next command will create a database consumer and password, and on the similar time grant all permission of the brand new database to the brand new consumer so in a while Mautic can write to the database. Change crimson texts together with your most popular database title, username and password.

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

    Flush privileges desk and exit MariaDB console.



    Step 3: Set up Required and Really helpful PHP Modules.

    Ubuntu 20.04 ships with PHP7.Four within the default repository. Mautic at present doesn’t help PHP7.4. For finest compatibility, it’s beneficial so as to add the PHP7.2 PPA and set up PHP7.2.

    sudo add-apt-repository ppa:ondrej/php

    Run the next command to put in PHP modules required or beneficial by Mautic

    sudo apt set up php-imagick php7.3-fpm php7.3-mysql php7.3-common php7.3-gd php7.3-imap php7.3-json php7.3-curl php7.3-zip php7.3-xml php7.3-mbstring php7.3-bz2 php7.3-intl php7.3-gmp

    When you use Apache net server, then it’s essential disable the PHP module for Apache.

    sudo a2dismod php7.4

    You additionally have to disable the prefork MPM module in Apache.

    sudo a2dismod mpm_prefork

    Now it’s essential run the next command to allow three modules so as to use PHP-FPM in Apache, no matter whether or not mod_php is put in in your server.

    sudo a2enmod mpm_event proxy_fcgi setenvif

    Then restart Apache.

    sudo systemctl restart apache2

    Step 4: Create Apache Digital Host or Nginx Config File for Mautic


    When you use Apache net server, create a digital host for Mautic.

    sudo nano /and so forth/apache2/sites-available/mautic.conf

    Put the next textual content into the file. Change together with your actual area title and don’t overlook to set DNS A file for it.

    DocumentRoot /var/www/mautic/

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/entry.log mixed

    Choices FollowSymLinks
    AllowOverride All

    Choices FollowSymLinks MultiViews
    AllowOverride All
    Order enable,deny
    enable from all


    Save and shut the file. Then allow this digital host with:

    sudo a2ensite mautic.conf

    Reload Apache for the modifications to take impact.

    sudo systemctl reload apache2

    Now it’s best to have the ability to see the Mautic web-based set up wizard at


    When you use Nginx net server, create a digital host for Mautic.

    sudo nano /and so forth/nginx/conf.d/mautic.conf

    Be aware: When you set up Mautic on iRedMail server, it’s best to create the digital host below /and so forth/nginx/sites-enabled/ listing.

    sudo nano /and so forth/nginx/sites-enabled/mautic.conf

    Put the next textual content into the file. Change together with your actual area title and don’t overlook to set DNS A file for it. Additionally observe that for those who set up Mautic on iRedMail server, it’s best to use the TCP socket ( as an alternative of the Unix socket (unix:/run/php/php7.4-fpm.sock).

    server {
    pay attention 80;
    pay attention [::]:80;

    root /var/www/mautic;
    error_log /var/log/nginx/mautic.error;
    access_log /var/log/nginx/mautic.entry;
    client_max_body_size 20M;

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

    location /

    location ~ /(mtc.js|1.js|mtracking.gif|.*.gif|mtc)

    # redirect some total folders
    rewrite ^/(vendor|translations|construct)/.* /index.php break;

    location ~ .php$
    embrace snippets/fastcgi-php.conf;
    fastcgi_pass unix:/run/php/php7.4-fpm.sock;
    #Be aware: When you set up Mautic on iRedMail server, it’s best to use the TCP socket as an alternative.

    location ~* ^/index.php

    # Deny every thing else in /app folder besides Property folder in bundles
    location ~ /app/bundles/.*/Property/
    enable all;
    access_log off;

    location ~ /app/ { deny all; }

    # Deny every thing else in /addons or /plugins folder besides Property folder in bundles
    location ~ /(addons|plugins)/.*/Property/
    enable all;
    access_log off;

    # location ~ /(addons|plugins)/ { deny all; }

    # Deny all php information in themes folder
    location ~* ^/themes/(.*).php {
    deny all;

    # Do not log favicon
    location = /favicon.ico {
    log_not_found off;
    access_log off;

    # Do not log robots
    location = /robots.txt {
    access_log off;
    log_not_found off;

    # Deny yml, twig, markdown, init file entry
    location ~* /(.*).(?:markdown|md|twig|yaml|yml|ht|htaccess|ini)$ {
    deny all;
    access_log off;
    log_not_found off;

    # Deny all makes an attempt to entry hidden information/folders resembling .htaccess, .htpasswd, .DS_Store (Mac), and so forth…
    location ~ /. {
    deny all;
    access_log off;
    log_not_found off;

    # Deny all grunt, composer information
    location ~* (Gruntfile|bundle|composer).(js|json)$ {
    deny all;
    access_log off;
    log_not_found off;

    # Deny entry to any information with a .php extension within the uploads listing
    location ~* /(?:uploads|information)/.*.php$ {
    deny all;

    # An extended browser cache lifetime can velocity up repeat visits to your web page
    location ~* .(jpg|jpeg|gif|png|webp|svg|woff|woff2|ttf|css|js|ico|xml)$ {
    access_log off;
    log_not_found off;
    expires 360d;

    Save and shut the file. Then take a look at Nginx configuration.

    sudo nginx -t

    If the take a look at is profitable, reload Nginx for the modifications to take impact.

    sudo systemctl reload nginx

    Now it’s best to have the ability to see the Mautic web-based set up wizard at

    Step 5: Enabling HTTPS

    To encrypt the HTTP site visitors, we will allow HTTPS by putting in a free TLS certificates issued from Let’s Encrypt. Run the next command to put in Let’s Encrypt consumer (certbot) on Ubuntu 20.04 server.

    sudo apt set up certbot

    When you use Nginx, then you definately additionally want to put in the Certbot Nginx plugin.

    sudo apt set up python3-certbot-nginx

    Subsequent, run the next command to acquire and set up TLS certificates.

    sudo certbot –nginx –agree-tos –redirect –hsts –staple-ocsp –email [email protected] -d

    When you use Apache, set up the Certbot Apache plugin.

    sudo apt set up python3-certbot-apache

    And run this command to acquire and set up TLS certificates.

    sudo certbot –apache –agree-tos –redirect –hsts –staple-ocsp –email [email protected] -d

    The place

    • –nginx: Use the nginx plugin.
    • –apache: Use the Apache plugin.
    • –agree-tos: Comply with phrases of service.
    • –redirect: Power HTTPS by 301 redirect.
    • –hsts: Add the Strict-Transport-Safety header to each HTTP response. Forcing browser to all the time use TLS for the area. Defends in opposition to SSL/TLS Stripping.
    • –staple-ocsp: Allows OCSP Stapling. A sound OCSP response is stapled to the certificates that the server gives throughout TLS.

    The certificates ought to now be obtained and robotically put in.

    mautic https letsencrypt

    Step 6: End Mautic Set up in Net Browser

    Now in your browser deal with bar, kind in your area title for Mautic to entry the net set up wizard.


    click on Subsequent Step.

    install mautic ubuntu 18.04

    In step 1, enter the MariaDB/MySQL database particulars.

    mautic mariadb database

    In step 2, create an admin account.

    install mautic on ubuntu 18.04 server

    In step 3, configure electronic mail settings. Be aware that you’ve many choices in mailer transport. You should utilize PHP Mail, sendmail, or Gmail or combine Mautic with third-party electronic mail providers like Mandrill, Sendgrid, Amazon SES. These settings can all the time be modified after set up in Mautic configurations web page. If Mautic is put in in your mail server, then it’s essential select Sendmail because the mailer transport, so Mautic will use your mail server to ship electronic mail.

    mautic email server configuration sendmail

    If Mautic and your mail server are operating on totally different machines and also you need Mautic to ship emails through your mail server, then it’s essential select Different SMTP server as mailer transport.

    • Enter the hostname of your mail server
    • Select port 587
    • Select TLS or SSL encryption.
    • Select Plain because the authentication mode
    • Enter the login credential of an electronic mail deal with in your mail server.

    mautic other smtp service

    After step Three is finished, you’ll be able to log into Mautic dashboard.

    mautic php7.2

    When you see the 500 inside server error, please verify Mautic logs, which could be present in /var/www/mautic/app/logs/ listing.

    Step 7: Allow HTTP2 to Enhance Efficiency

    You may allow HTTP2 protocol to enhance web page loading efficiency for Mautic.


    First, it’s essential allow the HTTP2 module.

    sudo a2enmod http2

    Then open the SSL digital host file.

    sudo nano /and so forth/apache2/sites-enabled/mautic-le-ssl.conf

    Put the next directive after the opening tag.

    Protocols h2 http/1.1

    Save and shut the file. Then restart Apache for the modifications to take impact.

    sudo systemctl restart apache2


    To allow HTTP2 protocol in Nginx digital host, discover the next line.

    pay attention 443 ssl; # managed by Certbot

    Merely add http2 after ssl.

    pay attention 443 ssl http2; # managed by Certbot

    Save and shut the file. Then reload Nginx.

    sudo systemctl reload nginx

    Step 8: Set up the RSS To Electronic mail Plugin

    For a lot of web site homeowners, the power to robotically fetch content material from RSS feed and ship it to subscribers is a should. Mautic doesn’t help this function natively, however you’ll be able to set up a plugin to implement this function. Go to the Mautic plugins listing.

    cd /var/www/mautic/plugins/

    Clone the Mautic RSS to Electronic mail plugin from Github.

    sudo apt set up git
    sudo -u www-data git clone

    Rename the folder to MauticRssToEmailBundle.

    sudo mv mautic-rss-to-email-bundle MauticRssToEmailBundle

    Clear the Mautic cache.

    sudo rm /var/www/mautic/app/cache/* -rf

    Within the Mautic dashboard, click on the gear icon on the upper-right nook and choose plugins. Click on the Set up/Improve plugins button and the Mautic RSS to Electronic mail plugin will present up within the plugin record.

    mautic rss to email

    Step 9: Add Cron Jobs

    Mautic depends on Cron jobs to replace mailing record segments, electronic mail advertising campaigns, marketing campaign occasions and course of electronic mail queues. Edit the www-data consumer’s crontab file. (You shouldn’t add Mautic instructions in root consumer’s crontab file.)

    sudo -u www-data crontab -e

    And add Mautic Cron jobs like under.

    ###### Mautic Cron Jobs #######

    # replace segments each 15 minutes
    * * * * * php7.3 /var/www/mautic/bin/console mautic:segments:replace > /dev/null

    # replace campaigns each 15 minutes beginning with an offset of 5 minutes originally of every hour
    5-59/15 * * * * php7.3 /var/www/mautic/bin/console mautic:campaigns:replace > /dev/null

    # execute campaigns occasions each 15 minutes with an offset of 10 minutes
    10-59/15 * * * * php7.3 /var/www/mautic/bin/console mautic:campaigns:set off > /dev/null

    # course of electronic mail queue
    2-59/15 * * * * php7.3 /var/www/mautic/bin/console mautic:emails:ship > /dev/null

    # import record within the background
    * * * * * php7.3 /var/www/mautic/bin/console mautic:import > /dev/null

    # replace MaxMind GeoLite2 IP Database as soon as every week
    @weekly php7.3 /var/www/mautic/bin/console mautic:iplookup:obtain > /dev/null

    Save and shut the file. Be aware that Mautic cron jobs might use a good quantity of CPU and RAM sources. If Mautic and iRedMail are put in on a server with 2GB RAM, you shouldn’t deploy extra packages on the server, or you’ll be able to select to improve the server specs.

    Step 10: Obtain IP Lookup Database

    In an effort to know the subscriber’s geolocation, it’s essential obtain MaxMind’s free GeoLite2 IP lookup database.

    First, it’s essential create an account at MaxMind. Maxmind will ship you an electronic mail. Click on the hyperlink within the electronic mail to set a password, then log in to your MaxMind account. Subsequent, choose My License Key on the left bar.

    maxmind license key

    Click on the Generate New License Key button.

    maxmind generate new license key

    Give your license key a reputation. Then select No, as a result of we don’t want to make use of the geoipupdate program. Then click on the Affirm button.


    As soon as the license key’s created, copy the license key. Go to Mautic dashboard, click on the cog icon on the higher proper nook and choose configuration. Within the System settings tab, scroll right down to Miscellaneous Settings.

    • Choose Maxmind GeoLite2 Metropolis Obtain for the IP lookup service
    • Paste your license key into the IP lookup service authentication discipline.

    Subsequent, Click on the Fetch IP Lookup Information Retailer button. Lastly, click on the Apply button on the upper-right nook.

    mautic maxmind geolite 2 city IP lookup

    Step 11: Set up the Monitoring JavaScript

    Within the monitoring settings tab, you’ll find a code snippet which you could add to your web site for monitoring guests. When you use WordPress, then copy this code snippet and paste it within the footer.php file below the WordPress theme folder.

    Muatic tracking javascript

    Be aware that it’s essential go to the System settings tab, and add your web site’s deal with within the CORS settings for the monitoring JavaScript to work.

    Mautic CORS settings

    While you’re at it, you also needs to set the default timezone on this web page.

    mautic set time zone

    Click on the Apply button. Be aware: I discovered that I want to attend a while for the timezone setting to take impact. You may clear Mautic cache with the next command for the timezone setting to take impact instantly.

    sudo rm /var/www/mautic/app/cache/* -rf

    Importing Contacts to Mautic

    Try the Mautic contact import web page. Please observe that when importing a big record (multiple thousand contacts) to Mautic, it’s best to select import within the background as an alternative of import within the browser. That’s as a result of the default PHP maximal execution time is 30 seconds, however importing a big record can take a number of minutes, so will probably be stopped by the PHP restrict for those who select to import within the browser.

    Replace to Mautic v3

    You’re suggested to again up information and database earlier than upgrading Mautic. To again up the Mautic information, merely run the next command, which can again up the /var/www/mautic/ listing to your own home listing.

    sudo tar -cpvzf ~/mautic.tar.gz /var/www/mautic/

    To again up the Mautic database, run the next command, which can again up the database to your own home listing.

    sudo mysqldump -u root mautic > ~/mautic.sql

    Then go to You will notice the improve wizard.

    mautic upgrade to mautic v3

    Click on Begin the improve button and look forward to it to complete.  upgrading mauticAs you’ll be able to see, the improve is profitable.

    you are ready to use Mautic 3

    Wrapping Up

    I hope this tutorial helped you put in Mautic on Ubuntu 20.04. You too can take a look at Mautic getting began information to discover ways to use it. As all the time, for those who discovered this put up helpful, then subscribe to our free publication to get extra suggestions and tips. Take care 🙂

    Charge this tutorial

    [Total: 0 Average: 0]

    install mailtrain ubuntu,install mautic on aws linux,mautic digitalocean,mautic installation,mautic latest version,ubuntu server lamp,how to install mautic,mautic pricing,mautic demo,mautic github,mautic features,mautic cloud,openemm,mautic direct download,digitalocean mautic,mautic database backup,geolite2 auto update,mautic upgrade,mautic agency version,install mautic in ubuntu,mautic server,best mail server for ubuntu,how to easily set up a full fledged mail server on ubuntu 18.04 with iredmail,how to install lamp server in ubuntu,ubuntu desktop web server

    Recent Articles

    Unravel the XDR Noise and Recognize a Proactive Approach

      Cybersecurity professionals know this drill nicely all too nicely. Making sense of heaps of info and noise to entry what actually issues. XDR (Prolonged Detection & Response) has been a technical acronym thrown round within the cybersecurity business with many notations and...

    PLATYPUS: Hackers Can Obtain Crypto Keys by Monitoring CPU Power Consumption

      Researchers have disclosed the small print of a brand new side-channel assault technique that can be utilized to acquire delicate data from a system...

    The Container configurations in Amazon ECS

      Revealed: November 7, 2020 | Modified: November 7, 2020 | Zero views A fast put up on superior container configurations in Amazon ECS. ECS container superior...

    Antivirus Testing – VIPRE for your Home and Business

      Individuals typically marvel, “What’s one of the best antivirus?” A number of distributors will declare that their product is one of the best within...

    Antivirus Testing – VIPRE for your Home and Business

      Individuals typically marvel, “What’s one of the best antivirus?” A number of distributors will declare that their product is one of the best within...

    Related Stories