DEV Community

Hiteshpandey for Pepipost

Posted on • Edited on

A quick guide on Mautic installation for Ubuntu 18.04

Mautic is one of the popular free open-source Marketing automation applications which can be used for multiple use cases of marketing paradigm. It ranges from sending bulk emails by uploading an Email list, Scheduling and Creating campaigns, Sending SMS and User journey.
This will be a quick detour on how you can set up Mautic service on your brand new server setup from scratch. But before that, here are some of the basic system requirements:

  • PHP 5.6.19 + (Magic Quotes GPC off)
  • MySQL 5.5.3 + (InnoDB support required)
  • Apache / Nginx
  • An SMTP service provider like Pepipost

You can check Mautic's official requirements page here

After confirming to these requirements you can now begin with the installation

Installation

Step 1: Enter into the root directory of your remote server

$ cd var/www/html/

Step 2: Create a new directory named Mautic

$ sudo mkdir mautic
$ cd mautic

Step 3: Download the Mautic production file package

To download Mautic at your local machine click here
Fill your credentials and click on the download button
The downloaded file would be named something like this 2.16.0.zip

Step 4: Copy the zip file to the remote server

Enter the following commands in your local machine download file location

$ scp -r 2.16.0.zip root@<your-domain-name/ip-address>:/var/www/html/mautic/mautic.zip

Note:- By any chance, you don’t have access to copy files to your server directory you can use FTP to upload the zip file, or you can use the git repo to clone it to your server directory, but you have to take some additional steps to get it up and running. Check this link for Mautic git repo.

Step 5: Unzip the file contents

    $ sudo unzip mautic.zip

If you don’t have unzip installed, you can install it by using

    $ sudo apt-get install unzip

Step 6: Delete the zip file

    $ sudo rm -rf mautic.zip

Step 7: Install php-fpm and dependencies

$ sudo apt install php libapache2-mod-php libapache2-mod-php php-common php-mbstring php-xmlrpc php-soap php-gd php-xml php-intl php-tidy php-mysql php-cli php-mcrypt php-ldap php-zip php-curl php-sqlite3 php-fpm

Step 8: Setting up MySQL

Install MySQL server

    $ sudo apt install mysql-server

Set MySQL root password

  • After the installation a temporary password will be generated in the mysqld.log file you can access this password by the following command $ sudo grep 'temporary password' /var/log/mysqld.log
  • Now you will get a message something like this [Note] A temporary password is generated for root@localhost: ,b*-rkuIR4Zas
  • Copy this password for the next step
  • Enter this command $ sudo mysql_secure_installation
  • This will prompt you to validate your password enter Y
  • After this, you will be prompted to set your password strength. Enter you choice between LOW, MEDIUM and STRONG.
  • Enter new password
  • You can say yes to all the other prompts that come after this
  • You will now be prompted with multiple questions on how to set up the MySQL installation. You can set Y to all the prompts
  • You will be able to login with the user root and a blank password Login to MySQL Create Mautic database and add User
mysql > create database mautic;
mysql > CREATE USER 'mauticuser'@'localhost' IDENTIFIED BY 'password';
mysql > GRANT ALL PRIVILEGES ON * . * TO 'mauticuser'@'localhost';
mysql > FLUSH PRIVILEGES;
mysql > exit;

Step 9: Setting up Http Server

(You can install Nginx or Apache server according to your needs)

  • Nginx: For installing Nginx you can follow these steps
$ sudo apt install nginx
$ sudo systemctl start nginx
$ sudo systemctl enable nginx

You need to make the following changes to nginx.conf file

$ vim /etc/nginx/nginx.conf
server {
       listen       80 default_server;
       listen       [::]:80 default_server;
       server_name  <Your domain name>;
       root         /var/www/html/mautic;
       location / {
               try_files $uri /index.php$is_args$args;
       }
       location ~ \.php$ {
       fastcgi_pass unix:/run/php/php7.2-fpm.sock;
       fastcgi_index index.php;
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
       include fastcgi_params;
       fastcgi_split_path_info ^(.+.php)(/.+)$;
       }
   }

Now depending upon your php-fpm setup you either need to add
fastcgi_pass 127.0.0.1:9000;
Or
fastcgi_pass unix:/var/run/php7.2-fpm.sock;
Note: If you are unclear on which value has to be set, you can check this in www.conf file.

    $ sudo vim /etc/php/7.2/fpm/pool.d/www.conf

Search for the listen parameter.

  • Apache: For installing Apache you can follow these steps
$ sudo apt install apache2
$ sudo systemctl start apache2
$ sudo systemctl enable apache2

You need to make the following changes to apache2.conf file

$ vim /etc/httpd/conf/httpd.conf
<VirtualHost *:80>
DocumentRoot /var/www/html/mautic
<Directory />
       Options FollowSymLinks
       AllowOverride All
   </Directory>
   <Directory /var/www/mautic>
       Options FollowSymLinks MultiViews
       AllowOverride All
       Order allow,deny
       Allow from All
   </Directory>
</VirtualHost>

After this you will be opening http://{your-domain-address} to open Mautic installation panel
There is more to this after the basic setup. But, since this tutorial is already too long here are some links to help you.
For more detailed setup on ubuntu 18.06 (Error resolutions | Setup | Setting up your first campaign) you can follow the original blog here — https://pepipost.com/tutorials/how-to-install-mautic-on-ubuntu-18-04/

Top comments (2)

Collapse
 
rcheesley profile image
Ruth Cheesley

Thanks for sharing!

It might be helpful to add a link to the requirements page at mautic.org/download/requirements as we're about to change the minimum requirements for PHP and MySQL when 3.0 is launched!

Collapse
 
hiteshpandey profile image
Hiteshpandey

Yes excited for Mautic 3 launch.