Mautic is powerful marketing automation software. It is free and it is also the world largest open-source marketing automation project.

More than 200.000+ organizations use Mautic. It makes Mautic an excellent choice if you want to run email marketing campaigns and marketing automation directly from your server, with full total control.

runcloud-mautic-13-dashboard

In this post, we will discuss about how to install Mautic using RunCloud easily.

Get Your Cloud Server And Connect To RunCloud

Cloud server is the best choice when you want to run your business with Mautic. It makes Mautic stable and also scalable. When your business start growing and Mautic needs more server resources, you can increase the resources (RAM/CPU) of your cloud server easily, anytime.

Five dollar ($5) cloud server from DigitalOcean / Linode / Vultr / UpCloud / other provider is more than enough to start using Mautic.

Quick guide on how to setup and connect your server to RunCloud

Create PHP Web Application In RunCloud

After setup and connect your server to RunCloud, you can create PHP web application to install Mautic.

Using RunCloud, you can create multiple website (web applications) in one server. Basically you can install Mautic on the same server where you host your other websites using RunCloud.

Go to “Web Application” menu under your server in RunCloud, and click “Create Web App” button.

runcloud-mautic-01-create-new-php-webapp

Let’s create your PHP web application for Mautic.

For “Web Application Name“, you can use “mauticapp“.

For “Domain name“, you can use either your own domain/subdomain or RunCloud test domain. For this example, we will use RunCloud test domain.

If you decide use your own domain, you will need to do an extra step to configure DNS record and wait for DNS propagation.

You can read our quick guide on how to add your domain.

For “Web Application Owner“, you can create new “mauticuser” system user.

It is best practice to use different system user for different web application in the same server, for extra security purpose.

runcloud-mautic-03-php73-version-advanced-settings

For “PHP Version“, you can select PHP7.3 to install Mautic v2.16 stable release. Please do not use PHP7.4 because Mautic still do not officially support it.

For “Web Application Stack“, you can choose “Nginx + Apache2 Hybrid” to allow you use .httaccess file in Mautic.

Please click “Advanced Settings” checkbox to configure some extra settings to make your Mautic installation run smoothly.

For date.timezone, you can select your current timezone where you run your business.

For disable_functions, it is optional, you can remove all php_posix functions from the list.

The php_posix is disabled by default inside RunCloud for security reason. For Mautic installation, it is just a recommendation to enable php_posix, not a requirement. But if you really want to enable php_posix, you can replace all the disable_functions with the text below.

getmyuid,passthru,leak,listen,diskfreespace,tmpfile,link,ignore_user_abord,shell_exec,dl,set_time_limit,exec,system,highlight_file,source,show_source,fpassthru,virtual,proc_open,proc_close,proc_nice,proc_terminate,escapeshellcmd,ini_alter,popen,pcntl_exec,socket_accept,socket_bind,socket_clear_error,socket_close,socket_connect,curl_multi_exec,symlink,ini_alter,socket_listen,socket_create_listen,socket_read,socket_create_pair,stream_socket_server

For max_execution_time, please increase the value to 120 to avoid any timeout / error issue on the installation process.

Then, click “Add Web Application” button to create your PHP web application for Mautic.

Prepare Mautic Installer

There are two ways to prepare Mautic installer:

  1. Download Mautic installer files and upload it to your web application using SFTP.
  2. Download and extract Mautic installer files using SSH.

In this post, we will show you the second way, using SSH.

You need to login to your server using SSH from either Terminal (Mac/Linux) or PowerShell / Putty (Windows).

If you want to login using password, not using SSH key, you will need to change the password of “mauticuser” system user that you have created from System User menu.

If you use Terminal, you can run this command to login to your server.

ssh mauticuser@<youripaddress>

You will login to your server using “mauticuser” system user, not root. Please change “youripaddress” with the IP Address of your server.

NOTE: Please do not login using “root”, to avoid any file/folder permission issue. 

Change the working directory to your “mauticapp” web application root path.

cd webapps/mauticapp

Download the Mautic script. The download might be a bit slow. Just wait for it to finish.

wget https://www.mautic.org/download/latest -O mautic.zip

Unzip/extract the downloaded file.

unzip mautic.zip

Run Mautic Installer

After preparing your Mautic installer, you can visit your domain/subdomain where you install Mautic.

Mautic recommends to secure your installation with an SSL certificate. You can skip this step if you use RunCloud free domain.

If you use your own domain/subdomain, you can install Let’s Encrypt SSL Certificate to your website. You can read our quick guide to secure your website with HTTPS.

Click “Next Step” button.

Mautic Installation – Database Setup

runcloud-mautic-09-database-setup

You need to create MySQL database to install Mautic. Go to “Database” menu under your server in RunCloud.

runcloud-mautic-06-create-database

Click “Create Database” button and create new “mauticdb” database.

runcloud-mautic-07-create-database-user

Click “Create Database User” button and create new “mauticdbuser” database user.

Then click “Grant User” button in your “mauticdb” database to connect it to “mauticdbuser” user.

Now you continue database setup process using database name and user that you have created.

Click “Next Step” button.

Mautic Installation – Administrative User

In this step, you can create the admin user for your Mautic installation.

Click “Next Step” button.

NOTE: If you get Error 500 screen after clicking “Next Step” button, it is possible because you have permission issue or you do not increase max_execution_time when creating PHP web application above.

You can fix it by running this command on your web application root path.

rm -rf app/cache/*
chmod 777 app/cache
php app/console cache:warmup

Mautic Installation – Email Configuration

In this step, you can setup Mautic email configuration. Mautic support sending email using PHP Mail, but we highly recommend you to use third party SMTP, for example SendGrid, Mailgun, or Amazon SES.

You can skip this step for now and setup email configuration later from your Mautic dashboard.

Click “Next Step” button.

Perfect!

When you see Mautic login screen, it means you have installed Mautic successfully!

Setup Mautic Cron Jobs

Mautic requires some cron jobs to run some maintenance tasks. You need to setup cron jobs to make sure Mautic can run properly.

Fortunately, you can add cron jobs easily using RunCloud.

Go to “Cron Job” menu under your server in RunCloud, and click “Create” button to create our first Mautic cron job.

Cron Job – Updating Contact Segments (Required)

runcloud-mautic-14-setup-cron-job

For “Job Label”, add mautic:segments:update

For “User”, add mauticuser, your system user for this Mautic web app.

For “Vendor Binary”, select /RunCloud/Packages/php73rc/bin/php because you use PHP7.3 for this Mautic web app.

For “Command”, copy paste this command below.

/home/mauticuser/webapps/mauticapp/app/console mautic:segments:update

NOTE: Please update this command if you use different system user (not mauticuser) and web application name (not mauticapp).

Because Mautic use multiple cron jobs, it is HIGHLY recommended that you stagger the required jobs so as to not run the exact same minute.

For “Minute”, please use 0,15,30,45 to run this cron job every 15 minutes. We will use different minutes for different cron jobs.

Click “Create Cron Job” button.

Cron Job – Updating Campaigns (Required)

Please repeat the process for following cron job.

Label : mautic:campaigns:update

Campaign :

/home/mauticuser/webapps/mauticapp/app/console mautic:campaigns:update

Minute : 5,20,35,50

Cron Job – Executing Campaign Events (Required)

Please repeat the process for following cron job.

Label : mautic:campaigns:trigger

Campaign :

/home/mauticuser/webapps/mauticapp/app/console mautic:campaigns:trigger

Minute : 10,25,40,55

Cron Job – Processing Email Queue (Optional)

Please repeat the process for following cron job.

Label : mautic:emails:send

Campaign :

/home/mauticuser/webapps/mauticapp/app/console mautic:emails:send

Minute : 2,17,32,47

Perfect!

You have completed cron jobs setup for Mautic.

Please check this article if you want to setup other optional cron jobs in Mautic.

Summary

If you want to use Mautic for your marketing automation software, using RunCloud and cloud server is a perfect combination to install and run Mautic Marketing Automation Software.

Are you using Mautic with RunCloud? Do not hesitate to share your experience with us.