In this article, you will learn to install Mautic, an open-source marketing automation tool. Part of the setup process will use Easy Engine to automate the deployment a LAMP stack.
You can use Mautic to create leads, manage online marketing campaigns and landing pages.
Before getting started you will need a cloud server instance as this tutorial is oriented towards a production-ready publicly available setup and some steps will require also access to a DNS panel to setup your domain settings (how to set up your public domain settings is not covered here).
You can start with a VPS that meets the following requirements:
- Ubuntu 16.04.03 64 bits or latest available
- 1 CPU
- 2 GB RAM
- 30 GB Hard drive
1. Check the system version
a. Log into your server and make sure the system is up-to-date.
ssh root@yourserverip lsb_release -a
Example:
root@newvps:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.3 LTS Release: 16.04 Codename: xenial
b. Run a system update if necessary to install the latest system patches and upgrades.
apt update && apt upgrade -y reboot
2. Check your DNS configuration
a. Make sure that your DNS settings are correct with one A record pointing to your server IP and a "www" subdomain in a CNAME record pointing to your domain.
dig www.yoursitedomain.net
Example:
user@workstation:~$ dig www.yoursitedomain.net ; <> DiG 9.9.5-9+deb8u14-Debian <> www.yoursitedomain.net ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9405 ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;www.yoursitedomain.net. IN A ;; ANSWER SECTION: www.yoursitedomain.net. 300 IN CNAME yoursitedomain.net. yoursitedomain.net. 60 IN A yourserverip ;; Query time: 96 msec ;; SERVER: 192.168.10.1#53(192.168.10.1) ;; WHEN: Sat Sep 16 03:56:05 CST 2017 ;; MSG SIZE rcvd: 68
3. Setup the name of your VPS to match your domain
a. Modify the DNS files for Ubuntu as root.
ssh root@yourserverip sudo -i cp -av /etc/hostname /etc/hostname.orig cp -av /etc/hosts /etc/hosts.orig echo "yoursitedomain.net" > /etc/hostname echo -e "\nyourserverip yoursitedomain.net yoursitedomain" >> /etc/hosts hostname yoursitedomain.net
b. Reboot the new instance with the new DNS setting and get back in, the new configuration should be working already.
reboot ssh root@yourserverip
4. Prepare the application deployment with Easy Engine
a. Install Easy Engine using the command line below as root.
sudo -i wget -qO ee rt.cx/ee && sudo bash ee
b. Use Easy Engine to deploy MySQL, NGINX, and PHP on the server, including the support for Let's Encrypt.
ee site create yoursitedomain.net --mysql --letsencrypt
Example:
root@yoursitedomain:~# ee site create yoursitedomain.net --mysql --letsencrypt Adding repository for MySQL, please wait... Adding repository for NGINX, please wait... Adding repository for PHP, please wait... Updating apt-cache, please wait... Installing packages, please wait... Downloading MySQLTuner [Done] Reload : postfix [OK] Reload : nginx [OK] Restart : php5.6-fpm[OK] Reload : mysql [OK] Running pre-update checks, please wait... Setting up NGINX configuration [Done] Setting up webroot [Done] Setting up database [Done] Reload : nginx [OK] HTTP Auth User Name: easyengine HTTP Auth Password : 4ZOQc2 Successfully created site http://yoursitedomain.net Letsencrypt is currently in beta phase. Do you wish to enable SSl now for yoursitedomain.net? Type "y" to continue [n]:y Please Wait while we fetch SSL Certificate for your site. It may take time depending upon network. Let's Encrypt successfully setup for your site Your certificate and chain have been saved at /etc/letsencrypt/live/yoursitedomain.net/fullchain.pem Configuring Nginx SSL configuration Adding /var/www/yoursitedomain.net/conf/nginx/ssl.conf Adding /etc/nginx/conf.d/force-ssl-yoursitedomain.net.conf Added HTTPS Force Redirection for Site http://yoursitedomain.net Creating Cron Job for cert auto-renewal Reload : nginx [OK] Congratulations! Successfully Configured SSl for Site https://yoursitedomain.net Your cert will expire within 89 days. root@yoursitedomain:~#
5. Download and Install Mautic
a. Download the Mautic sources from GitHub with the web directory for the application.
cd /var/www/yoursitedomain.net/ rm -rf htdocs wget https://github.com/mautic/mautic/archive/master.zip unzip master.zip mv mautic-master htdocs cd htdocs
b. Download and Install PHP Composer to complete the installation process.
apt -y install curl curl -s https://getcomposer.org/installer | php mv -v composer.phar /usr/local/bin/composer composer install cd .. chown -R www-data: htdocs
6. Tune PHP, MySQL and Nginx to work with your Mautic application
a. Get the root password for your MySQL server.
cat /etc/mysql/conf.d/my.cnf
.
b. Access your MySQL server and create the user and database for Mautic.
mysql -uroot -p CREATE DATABASE mautic_data; CREATE USER 'mautic_user'@'localhost' IDENTIFIED BY 'RRl4$3W7fvpdKd#OVNV'; GRANT ALL PRIVILEGES ON mautic_data.* TO 'mautic_user'@'localhost';
Example:
root@yoursitedomain:/var/www/yoursitedomain.net# mysql -uroot -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 27 Server version: 10.1.26-MariaDB-1~xenial mariadb.org binary distribution Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> CREATE DATABASE mautic_data; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> CREATE USER 'mautic_user'@'localhost' IDENTIFIED BY 'RRl4$3W7fvpdKd#OVNV'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON mautic_data.* TO 'mautic_user'@'localhost'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> quit Bye
c. Update the PHP configuration for the PHP FastCGI.
sed -i "47ialways_populate_raw_post_data = -1" /etc/php/5.6/fpm/php.ini
d. Update the Nginx Configuration to fix a problem with Mautic accessing its assets when a redirect to the SSL site version is enabled.
cat "rewrite ^/index.php/(.*)$ /$1 last;" > /var/www/yoursitedomain.net/conf/nginx/urlfix.conf
e. Make sure to change the file ownership are setup correctly.
chown www-data: /var/www/yoursitedomain.net/conf/nginx/urlfix.conf
f. Restart the PHP FastCGI and Nginx services.
service php5.6-fpm restart systemctl restart nginx
7. Run the Mautic setup wizard
a. Open a browser and enter this URL: https://yoursitedomain.net to start the configuration wizard.
b. During the setup make sure to enter your database settings, as in the box below:
Database Settings
user : mautic_user
pass : RRl4$3W7fvpdKd#OVNV
db : mautic_data
c. Setup an admin user and password for the application ( they shouldn't be same as your database user and password )
Mautic Administrator
user: mautic-admin
pass: F1e#vQueb+Jouwegibyu
d. Once the setup wizard as finished, go back to the server console and add these cronjobs.
# Setting up Mautic cron jobs, # please refer to https://www.mautic.org/docs/en/setup/cron_jobs.html for further details # Updating Contact Segments 0,15,30,45 * * * * /usr/bin/php /var/www/yoursitedomain.net/htdocs/app/console mautic:segments:update # Campaign Updates 5,20,35,50 * * * * /usr/bin/php /var/www/yoursitedomain.net/htdocs/app/console mautic:campaigns:rebuild # Email Delivery 10,25,40,55 * * * * /usr/bin/php /var/www/yoursitedomain.net/htdocs/app/console mautic:emails:send
c. Download and deploy the IP Lookup library to finish the setup of mautic.
php /var/www/yoursitedomain.net/htdocs/app/console mautic:iplookup:download chown -R www-data: /var/www/yoursitedomain.net service php5.6-fpm restart systemctl restart nginx
At this point, you should have your Mautic server up and running, so I recommend getting started with the site official documentation to learn how to setup your campaigns and create landing pages for your eCommerce site.
i am really happy by this article. Really helpful for noobie like me. Thanks. Really appriciate this. And easy engine is love
Any chance you can update this for EE4? Not a single guide out yet. I still use old EE version
Hi Kamron,
Sure we will have a look on EE4