PT

Search

How to install Mautic: VPS, Docker, CloudPanel and more

How to install Mautic with four methods (VPS, Docker, CloudPanel, one-click), plus the SMTP, cron and HTTPS setup that makes it actually work.

Gabriel Pedroso10 min read
How to install Mautic

The installer is the easy part when you install Mautic. What separates a Mautic that works from one that sits there silently is the setup that comes after it: file permissions, SMTP with DNS authentication, cron and HTTPS. Skipping any of them is the number one cause of "I installed it and it does not send email".

There is a way to install Mautic for every profile, from a Linux VPS with full control to Docker and one-click panels. This guide covers all four and then the post-install setup that most tutorials treat as a detail.

Requirements to install Mautic

Check the server before you install Mautic. Underpowered machines, shared hosting in particular, cause most of the slowness and hard-to-diagnose intermittent errors.

ComponentMinimumNotes
PHP8.1+8.2 or 8.3 recommended, with OPcache enabled.
DatabaseMySQL 8.0+ or a recent MariaDBInnoDB is required. Mautic does not support PostgreSQL.
Web serverApache 2.4+ or NginxOn Apache, enable mod_rewrite for clean URLs.
PHP extensionscurl, gd, imap, intl, mbstring, mysqli/pdo_mysql, xml, zip, bcmathimap is what lets you process bounces later.
Memory2 GB of RAM4 GB or more past 100K contacts.
DiskSSD, 10 GB to startMySQL slows down a lot on spinning disks.

As a sizing reference, a base of up to 10,000 contacts runs well on a VPS with 2 vCPUs and 4 GB of RAM. Once you pass a few tens of thousands of contacts, move the database to its own server and consider an in-memory cache such as Redis.

Method 1: install Mautic on a Linux VPS

This is the method with the most control, and it assumes you are comfortable on an Ubuntu or Debian server. Start by updating the system and installing PHP, MySQL and Nginx:

ssh root@your_vps_ip
sudo apt update && sudo apt upgrade -y
sudo apt install -y php8.3 php8.3-{cli,common,mysql,zip,gd,mbstring,curl,xml,fpm,intl} mysql-server nginx

Create the database and a dedicated user. Replace the password placeholder with a strong one of your own:

sudo mysql
CREATE DATABASE mautic CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'mautic_user'@'localhost' IDENTIFIED BY 'your_strong_password';
GRANT ALL PRIVILEGES ON mautic.* TO 'mautic_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Download the release package and extract it:

cd /var/www
# check the latest stable version at github.com/mautic/mautic/releases
sudo wget https://github.com/mautic/mautic/releases/download/5.0.0/mautic-5.0.0.zip
sudo unzip mautic-5.0.0.zip -d mautic
sudo chown -R www-data:www-data mautic
sudo chmod -R 755 mautic

If you version your installation or want it for production, Composer is the recommended route instead. The mautic:install command requires the site URL as an argument and will not run without it:

composer create-project mautic/recommended-project:^5 mautic --no-interaction
cd mautic
php bin/console mautic:install https://mautic.example.com --force \
  --db_driver=pdo_mysql \
  --db_host=localhost \
  --db_name=mautic \
  --db_user=mautic_user \
  --db_password=YOUR_PASSWORD \
  --admin_email=you@example.com \
  --admin_password=YOUR_ADMIN_PASSWORD

The console lives in bin/console, while older Mautic versions used app/console. Every command in this guide uses bin/console.

Next, point Nginx at the folder. Create /etc/nginx/sites-available/mautic, using your own domain in place of your_domain.com:

server {
    listen 80;
    server_name your_domain.com www.your_domain.com;
    root /var/www/mautic;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location ~ /\.ht {
        deny all;
    }
}

Enable the site with sudo ln -s /etc/nginx/sites-available/mautic /etc/nginx/sites-enabled/ and run sudo systemctl reload nginx. On Apache, the virtual host needs AllowOverride All so Mautic's .htaccess can rewrite URLs. Without it, internal pages return 404.

If you used the ZIP, open http://your_domain.com/installer in the browser and follow the wizard. In the database step, enter localhost as the host plus the database name, user and password you created above.

Method 2: Docker

Docker is a good way to install Mautic for testing, or when you do not want to deal with PHP dependencies. The setup is isolated, reproducible and portable between servers. Install the docker.io and docker-compose-plugin packages, add your user to the docker group, then create a docker-compose.yml:

services:
  mysql:
    image: mysql:8.0
    environment:
      MYSQL_ROOT_PASSWORD: rootpassword
      MYSQL_DATABASE: mautic
      MYSQL_USER: mautic_user
      MYSQL_PASSWORD: mauticpass123
    volumes:
      - mysql_data:/var/lib/mysql
    ports:
      - "3306:3306"

  mautic:
    image: mautic/mautic:latest
    environment:
      MAUTIC_DB_HOST: mysql
      MAUTIC_DB_USER: mautic_user
      MAUTIC_DB_PASSWORD: mauticpass123
      MAUTIC_DB_NAME: mautic
    volumes:
      - mautic_data:/var/www/html
    ports:
      - "80:80"
    depends_on:
      - mysql

volumes:
  mysql_data:
  mautic_data:

Start it with docker compose up -d and follow the logs with docker compose logs -f mautic. Mautic will be available at http://localhost or your server IP within minutes.

Method 3: CloudPanel

CloudPanel is a control panel that can install Mautic in a few clicks, which suits people who would rather avoid the command line. Get a VPS that supports it (Hetzner, Linode or DigitalOcean, for example) and install the panel over SSH:

curl -sSL https://installer.cloudpanel.io/ce | sudo bash

Open https://your_server_ip:8443, create an account and go to Application, then New Application. Search for Mautic, pick the domain and click Add. CloudPanel handles the installation, plus SSL through Let's Encrypt, backups and updates. The Community edition is free, so your only cost is the VPS.

Method 4: one-click installers

Some hosting providers include Mautic in an auto-installer such as Softaculous or Installatron. In the hosting panel, search for Mautic, click Install and choose the domain. It runs in about five minutes.

After you install Mautic: the setup that makes it work

However you install Mautic, these next steps decide whether it actually sends and tracks.

File permissions and the 500 error

Mautic writes cache, logs and uploaded files to disk. If the web server user (usually www-data on Debian and Ubuntu) does not own these folders, you get a blank 500 error right after installing, with no useful message. The folders that must be writable are var/ (cache, logs and the email spool), config/ (where Mautic saves local.php with your credentials) and media/. Set owner and permissions like this:

sudo chown -R www-data:www-data /var/www/mautic
sudo find /var/www/mautic -type d -exec chmod 755 {} \;
sudo find /var/www/mautic -type f -exec chmod 644 {} \;

SMTP and email authentication

Without SMTP, Mautic sends no email at all. Go to Settings, then Email Settings, and point it to a transactional sending service such as Amazon SES or Mailgun. Both charge by volume, at low rates per thousand emails. With Amazon SES, use email-smtp.us-east-1.amazonaws.com (or your region's host), port 587 with STARTTLS, and the SMTP credentials generated in the SES console. A new SES account can only send to addresses you have verified, so request a higher limit after a few days.

SMTP gets the email out. The DNS records on your domain decide whether it lands in the inbox or in spam, and you need all three:

  • SPF authorizes the provider to send for your domain, for example v=spf1 include:amazonses.com ~all.
  • DKIM signs each message. SES and Mailgun give you the keys, usually as CNAME records.
  • DMARC tells the receiving server what to do when SPF or DKIM fails. Start in monitoring mode: v=DMARC1; p=none; rua=mailto:dmarc@example.com

Set up all three before your first campaign, because a correct SMTP setup with incomplete DNS still lands in spam.

Cron jobs

Mautic does its background work through cron jobs. Without them the interface opens and contacts come in, but nothing gets processed. Four commands form the core, and their order matters because each one depends on the result of the previous one:

CommandWhat it doesFrequency
mautic:segments:updateRecalculates dynamic segment members~15 min
mautic:campaigns:rebuildAdds and removes contacts in campaigns~15 min
mautic:campaigns:triggerFires scheduled campaign actions~15 min
mautic:emails:sendSends the email queue to SMTP~5 min

Schedule them in the system crontab (crontab -e) and never in Mautic's internal scheduler, which only runs when someone opens the application:

*/15 * * * * php /var/www/mautic/bin/console mautic:segments:update --no-interaction
*/15 * * * * php /var/www/mautic/bin/console mautic:campaigns:rebuild --no-interaction
*/15 * * * * php /var/www/mautic/bin/console mautic:campaigns:trigger --no-interaction
*/5 * * * * php /var/www/mautic/bin/console mautic:emails:send --no-interaction

For production you should stagger the minutes, wrap each line in flock and use the full PHP path. My guide to Mautic cron jobs covers those details and the maintenance jobs.

HTTPS and the site URL

Mautic needs HTTPS in production. Without SSL, browsers block the tracking script as mixed content and email links get flagged as insecure. Let's Encrypt is free, and on Nginx you can get the certificate with certbot:

sudo apt install -y certbot python3-certbot-nginx
sudo certbot certonly --nginx -d your_domain.com

With SSL active, open Settings and set the Site URL to the full HTTPS address. Mautic builds the tracking script and email links from it. Set the time zone and locale so schedules match your local time, write the unsubscribe message and set the mailbox for bounce handling. Then add the tracking script to your site, which is the same step you use to connect Mautic and WordPress.

Troubleshooting a new installation

For a 500 error, check folder ownership first, then read the web server log (/var/log/nginx/error.log or /var/log/apache2/error.log) and the Mautic log in var/logs/mautic_prod.log. If the database does not connect, confirm MySQL is running with sudo systemctl status mysql and test the credentials with mysql -u mautic_user -p mautic. Other common problems are in my Mautic troubleshooting guide.

For larger bases, add Redis as a cache, raise max_connections in MySQL and pm.max_children in PHP-FPM, and back up the database and files daily. Well tuned, Mautic on a modest VPS handles large bases at a fraction of the cost of an equivalent SaaS platform.

Mautic installation FAQ

What is the best way to install Mautic for beginners?

If you are just starting, CloudPanel or a one-click installer removes most of the manual work. If you are comfortable with Linux, the VPS method gives you more control and costs less.

Can I install Mautic on shared hosting?

Usually not. Shared hosting rarely gives you dedicated cron jobs or the PHP extensions and resource limits Mautic needs. Use a VPS, or a panel such as CloudPanel on a VPS.

Does Mautic support PostgreSQL?

No. Mautic runs on MySQL or MariaDB. Use MySQL 8.0+ or a recent MariaDB version.

How much does a Mautic installation cost?

The software is free, so you pay only for infrastructure. An entry-level VPS is enough to start, and the cost rises as your contact base and sending volume grow.

How do I back up a Mautic installation?

Back up the database and the /var/www/mautic folder, and test a restore from time to time. For the database, use mysqldump -u mautic_user -p mautic > backup.sql.

Next steps

With Mautic running, start with forms and simple emails before you build complex campaigns. If you are still deciding whether it fits your team, read what is Mautic. The official Mautic documentation is the reference for each step, and you can download releases from mautic.org.