Today we are goig to learn that how to install Mautic Marketing Software On Ubuntu 20.04. Before moving towards the installation process, let’s have a short introduction about Mautic Marketing Software.
Introduction:
Mautic Marketing Software is an open source powerfull marketing tool that is used to grow your business and reach more customers. As you all know, marketing plays an important role in any business. If you don’t reach people it means your business is not getting good profit.
In this modern era comapnies and business person use different techniques in order to achieve more profit and more customers. So, today we are going to talk about such a powerful tool that can be used for marketing purposes to attain more customers or sell more products. Let’s move towards the installation process. Just follow the below steps for an easy and optimal installtion.
Requirements:
Here’s the list of required packages for Mautic Marketing Software Installation.
- PHP version 7.2 or above ^ less than 7.4
- PHP Modules
- zip, xml, mcrypt, imap, mailparse
- Web Server (Apache or Nginx)
- Database Server
- Git
- Composer
Step 1: Update Your System
As usual we do, update your system to have the latest packages installed. To do so, hit the below command.
sudo apt update -y And then hit the below command to install some essential packages.
sudo apt install vim git unzip curl -y
Step 2: Install & Configure Database Server
To store the data you need a database server, so we’re going to use MariaDB in this guide. Mautic will use it to store data. We also have to create a database for the Mautic Marketing Software. To install MariaDB on Ubuntu 20.04 visit the below link in case you don’t have installed.
How To Install MariaDB On Ubuntu 20.04
After installing the database, create a database for Mautic.
sabi@Ubuntu20:~$ sudo mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 50 Server version: 10.3.25-MariaDB-0ubuntu0.20.04.1 Ubuntu 20.04 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> CREATE DATABASE mauticdb; Query OK, 1 row affected (0.000 sec) MariaDB [(none)]> CREATE USER 'mauticuser'@'localhost' IDENTIFIED BY 'Your_Password'; Query OK, 0 rows affected (0.001 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON mauticdb . * TO 'mauticuser'@'localhost'; Query OK, 0 rows affected (0.000 sec) MariaDB [(none)]> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.000 sec) MariaDB [(none)]> exit; Bye
Step 3: Install & Configure Web Server & PHP
As mentioned in the requirements, we need a web server for serving the web pages. So, it’s up to you to use Apache or Nginx but I’ll recommend you to use Nginx Web Server for Mautic Markeeting Software. Also, install the PHP and the required dependencies.
sudo apt install nginx -y
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install -y php7.3
sudo apt install php7.3-{cli,fpm,json,common,mysql,zip,gd,mbstring,curl,xml,bcmath,imap,intl} php-pear
Verify the status of PHP-fpm services.
sabi@Ubuntu20:~$ sudo systemctl status php7.3-fpm ● php7.3-fpm.service - The PHP 7.3 FastCGI Process Manager Loaded: loaded (/lib/systemd/system/php7.3-fpm.service; enabled; vendor p> Active: active (running) since Thu 2020-10-29 16:00:43 PKT; 12s ago Docs: man:php-fpm7.3(8) Process: 18795 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /r> Main PID: 18775 (php-fpm7.3) Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0re> Tasks: 3 (limit: 3450) Memory: 11.4M CGroup: /system.slice/php7.3-fpm.service ├─18775 php-fpm: master process (/etc/php/7.3/fpm/php-fpm.conf) ├─18793 php-fpm: pool www └─18794 php-fpm: pool www اکتوبر 29 16:00:43 Ubuntu20 systemd[1]: Starting The PHP 7.3 FastCGI Process M> اکتوبر 29 16:00:43 Ubuntu20 systemd[1]: Started The PHP 7.3 FastCGI Process Ma> lines 1-16/16 (END)
Step 4: Configure PHP with Mautic Recommended Settings
Edit the php.ini file under /etc/php/7.3/fpm/ directory and setup the timezone.
sudo nano /etc/php/7.3/fpm/php.ini
And then set the Memory limit to 512M and save the file.
Now, make some changes to the Nginx to configure it with Mautic. Switch to the /etc/nginx/sites-enaled/ directory and backup the default file. After backup, create a new file.
cd /etc/nginx/sites-enabled/ sudo mv default /tmp sudo vim /etc/nginx/sites-enabled/mautic.conf
Then paste the below content in the newly created file.
server { listen 80 default_server; listen [::]:80 default_server; server_name example.com; root /var/www/html/mautic; index index.html index.htm index.php; location / { try_files $uri /index.php$is_args$args; } location ~ .php$ { fastcgi_pass unix:/run/php/php7.3-fpm.sock; fastcgi_index index.php; fastcgi_read_timeout 240; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_split_path_info ^(.+.php)(/.+)$; } rewrite ^themes/./(layouts|pages|partials)/..htm /index.php break; rewrite ^bootstrap/.* /index.php break; rewrite ^config/.* /index.php break; rewrite ^vendor/.* /index.php break; rewrite ^storage/cms/.* /index.php break; rewrite ^storage/logs/.* /index.php break; rewrite ^storage/framework/.* /index.php break; rewrite ^storage/temp/protected/.* /index.php break; rewrite ^storage/app/uploads/protected/.* /index.php break; }
Swith to the root directory where Webserver will check for the Mautic files & clone the mautic files. You can change the directory according to your needs.
cd /var/www/html/ sudo git clone https://github.com/mautic/mautic.git
After cloning the files, install the composer. To install it, hit the below command in your terminal.
cd ~ curl -sS https://getcomposer.org/installer -o composer-setup.php sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer --version=1.0.0-alpha8
Verify the installation by typing
sabi@Ubuntu20:~$ composer -V Composer version 1.0.0-alpha8 2014-01-06 18:39:59
Once installtion is successful, switch to root directory & run the composer install.
cd /var/www/html/mautic
sudo composer install
It’ll take some time to complete the process.
And then change the Mautic’s files permissions to Nginx.
sudo chown -R www-data:www-data /var/www/html/mautic/ sudo chmod -R 755 /var/www/html/mautic/
Restart php-fpm services.
sudo systemctl restart nginx php7.3-fpm
Step 5: Finish Mautic Installation Via Web Panel
Type the IP address or domain name to launch the Mautic web dashboard. You’ll see the welcome page. Here you can see the recommendations to apply if you want otherwise click on the “Next Step” button.
On the next page provide Database details we’ve created earlier for Mautic and in the left bottom click on “No” (as we’ve not created database tables). And then, click on “Next Step” button.
Now, type your admin details alongwith email address and move to the next page.
Next, provide your Mail Settings, and clik on “Next Setup”.And enter your admin credentials to login to the web dashboard. So, here you can add new comapigns, contacts and configure much more.
Step 6: Add Cron Jobs for Mautic
As Mautic needs some cron jobs for handling the maintenance process and updating the compaigns and actions, so do it with the help of below cron job. You can also customize it according to your own needs.
sudo crontab -e */10 * * * 1 php /var/www/html/mautic/app/console mautic:segments:update >> /var/log/cronmautic.log 2>&1 */20 * * * 3 php /var/www/html/mautic/app/console mautic:campaigns:update >> /var/log/cronmautic.log 2>&1 */30 * * * 5 php /var/www/html/mautic/app/console mautic:campaigns:trigger >> /var/log/cronmautic.log 2>&1
You can set your own time to run cron jobs. Here I’ll list the basic info.
.---------------- minute (0 - 59) | .------------- hour (0 - 23) | | .---------- day of month (1 - 31) | | | .------- month (1 - 12) OR jan,feb,mar,apr … | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat | | | | | * * * * * user-name command to be executed
So, this is how you can install Mautic Marketing Software on Ubuntu 20.04.