This guide shows you how to install Mautic 5 on a fresh Ubuntu 22.04 DigitalOcean droplet with 4 GB of RAM. We’ll configure Apache, MariaDB, PHP 8.1, Node.js 20, and Certbot (for Let’s Encrypt SSL) — ensuring the certificate is installed before running the Mautic web-based setup.
Once created, copy the public IP address of your new droplet. You’ll use this to SSH in and to access Mautic in a browser.
apt-get update -y
apt-get upgrade -y
reboot
This updates and upgrades server packages to their latest versions. A reboot is typically a good idea afterward on a new installation.
apt-get install -y apache2
systemctl enable apache2
systemctl start apache2
systemctl status apache2
Visit http://YOUR_DROPLET_IP
in a browser to confirm Apache’s default page loads.
apt-get install -y mariadb-server mariadb-client
systemctl enable mariadb
systemctl start mariadb
mysql_secure_installation
Follow the prompts to set a root password, remove the test database, etc.
Next, create a dedicated database and user for Mautic:
mysql -e "CREATE DATABASE mautic;"
mysql -e "CREATE USER 'mautic_user'@'localhost' IDENTIFIED BY 'YourStrongPassword';"
mysql -e "GRANT ALL PRIVILEGES ON mautic.* TO 'mautic_user'@'localhost';"
mysql -e "FLUSH PRIVILEGES;"
You can use any names you like, but in this example we create a database mautic
and a user mautic_user
with a secure password.
apt-get install -y php8.1 php8.1-cli php8.1-curl php8.1-mbstring php8.1-mysql \
php8.1-xml php8.1-zip php8.1-intl php8.1-gd php8.1-imap php8.1-bcmath \
libapache2-mod-php8.1 unzip
php8.1-imap
is important if Mautic will handle inbound email. If not needed, you can omit it.
apt-get remove --purge -y nodejs libnode-dev
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs
node -v # Should show v20.x
npm -v # Should show 10.x
Mautic 5’s build process and certain plugins require Node.js 20 and npm 10.
curl -sS https://getcomposer.org/installer -o composer-setup.php
php composer-setup.php --install-dir=/usr/local/bin --filename=composer
rm composer-setup.php
sudo -u www-data composer -V
We’ll continue to run Composer as www-data
to avoid permissions issues.
a2enmod rewrite
a2enmod headers
systemctl restart apache2
mkdir -p /var/www/mautic
chown -R www-data:www-data /var/www
Ensuring www-data
can write here simplifies installation via Composer later.
Create (or edit) /etc/apache2/sites-available/mautic.conf
:
<VirtualHost *:80>
ServerName your-domain.com
ServerAlias www.your-domain.com
DocumentRoot /var/www/mautic/docroot
<Directory /var/www/mautic/docroot>
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/mautic_error.log
CustomLog ${APACHE_LOG_DIR}/mautic_access.log combined
</VirtualHost>
a2ensite mautic.conf
a2dissite 000-default.conf # optional
systemctl reload apache2
your-domain.com
pointing to your droplet’s public IP.www.your-domain.com
pointing to your-domain.com
.13. Install Certbot and Obtain SSL Certificate
Let’s Encrypt will secure your domain before you run Mautic’s web-based setup.
sudo apt-get update
sudo apt-get install -y certbot python3-certbot-apache
certbot --version # Optional: verify
sudo certbot --apache
Follow the prompts to select your domain, enable HTTPS, and optionally force redirect from HTTP to HTTPS.
sudo -u www-data composer create-project mautic/recommended-project:^5 /var/www/mautic --no-interaction
This downloads the Mautic 5.x codebase into /var/www/mautic
, owned by www-data
.
sed -i 's/^memory_limit =.*/memory_limit = 512M/' /etc/php/8.1/apache2/php.ini
sed -i 's/^upload_max_filesize =.*/upload_max_filesize = 64M/' /etc/php/8.1/apache2/php.ini
sed -i 's/^post_max_size =.*/post_max_size = 64M/' /etc/php/8.1/apache2/php.ini
sed -i 's/^max_execution_time =.*/max_execution_time = 300/' /etc/php/8.1/apache2/php.ini
systemctl restart apache2
Now that SSL is configured, visit https://your-domain.com to run Mautic’s web-based setup:
localhost
mautic
mautic_user
Tip: If you see a 404 error after install, confirm your DocumentRoot
is /var/www/mautic/docroot
(or public
, depending on your Mautic structure) and that .htaccess
is allowed in your Apache config.
You now have a fully functional Mautic 5 instance with SSL in place before opening the Mautic installer in a browser. From here, you can configure cron jobs, integrate email providers, and use Mautic’s powerful marketing automation features!