Business, Tutorial, Ubuntu

How to install Mautic on an Ubuntu Server at Digital Ocean

The server installation guide in the docs for Mautic is ‘pretty good’ but still expects that you’re already a system admin kind of person and now how to do stuff. I’ll walk you through the install in the usual way I do in hopes that it helps some of the steps.

This link shows the server requirements

  1. users
  2. install apache2: sudo apt install apache2
  3. install mariadb-server: sudo apt install mariadb-server

3.5 set up maria db

You can just use ‘Big Step 4’ from this blog I wrote a while back and change the stuff from ‘akaunting’ to mautic but remember the syntax update:

GRANT ALL PRIVILEGES ON mautic_db.* TO 'mauticuser'@'localhost';

you might get a bug where the database doesn’t connect later. If so, run this command:

ALTER USER 'mauticuser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'passwordstring';

  1. install php stuff: it seems like Ubuntu should already comes with php7.4 in the packages these days but Mautick docs are showing 7.2 or 7.3 support so better downgrade. Check your version with this command if you’d like php -v

If you haven’t installed PHP yet, you can simply install it and it should be enabled as the only php version with these commands:

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.3

Otherwise, you might have to *downgrade from 7.4 to 7.3 depending on what you’ve already done on the server. Thankfully I’ve already blogged on this from a Prestashop issue I was having: Read the solution section of this blog

Now that you have installed 7.3 in stall these packages (I guess) from some old package list I found for Mautic with php 7.2 commands which I then upgraded to 7.3 format:

sudo apt install libapache2-mod-php7.3 php7.3 php7.3-common php7.3-curl php7.3-imagick php7.3-mbstring php7.3-xmlrpc php7.3-soap php7.3-gd php7.3-xml php7.3-intl php7.3-tidy php7.3-mysql php7.3-cli php7.3-ldap php7.0-json php7.3-xsl php7.3-zip php7.3-curl php7.3-sqlite3 php7.3-fpm php7.3-imap

4.5 Edit the PHP file with the recommended setting change:
sudo nano etc/php/7.3/apache2/php.ini

  • control+w to search for ‘max_execution_time’ and change to 240s or more (default is usually 30s)
  • control x to save and yes to write changes.

FYI I always like these kind of php package lists to control F search the page from time to time

  1. Create the mautic directory on server
    You can alter this path and name if you like but this is what I did:

sudo mkdir /var/www/html/mautic

  1. Install composer so you can get the files from github
    sudo apt install composer
  2. clone and git the files
    change into your mautic directory:

cd /var/www/html/mautic

sudo git clone -b 3.0.0-beta https://github.com/mautic/mautic.git mautic
sudo composer install

  1. Do permission stuff and ownership stuff to the mautic folder

ownership: sudo chown -R www-data:www-data /var/www/html/mautic/mautic
permissions: sudo chmod -R 755 /var/www/html/mautic

Note this from this blog

sudo chown -R www-data:www-data /var/www/html/mautic/

  1. Point your apache stuff to your mautic files root
  • copy the original conf file in sites-available directory:
    sudo cp 000-default.conf mautic.conf
  • edit to put your domain stuff in the new mautic.conf file:
    sudo nano mautic.conf
  • Make sure this kind of stuff looks like this and adjust to your setup as needed:

ServerName domain.ca
ServerAlias www.domain.ca
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/mautic

I also added this block from another tutorial, not sure if it’s critical:

<Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
    <Directory /var/www/mautic>
        Options FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        Allow from All
    </Directory>

make absolutely sure all your paths match reality!

  • Control x to exit and yes to save changes
  • Restart apache: sudo systemctl restart apache2.service
  1. Lets encrypt while we’re at it…

Lets Encrypt is the excellent free SSL certificate generating software.

  • install it: sudo apt install certbot python3-certbot-apache
    sudo certbot --apache

(make sure your firewall is open… read my akaunting blog above for more on that)

Ok, now you have:

  • apache installed
  • data base installed (mariadb) and created
  • php and dependencies installed
  • mautic files downloaded and ready to roll
  • site is enabled
  • lets encrypt is run

Let’s go for the big moment. Point your browser to wherever domain it’s pointed and see what happens…

Hope this either helped or worked

Tagged , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *