• Home
  • >
  • Blog
  • >
  • Install Mautic on your own VPS (Virtual Private Server)

Install Mautic on your own VPS (Virtual Private Server)

By Alex • 5. April 2023

In my last post you've learned how to install WordPress on your own VPS. This time, we're going to install Mautic on the same Server. With that, you'll have a single VPS which costs you around 10$ per month with the core systems for your onlineshop and e-commerce business. If you don't have a clue on how to secure your VPS, maybe you should use hosting services like our Mautic Hosting. As soon as you deal with real-life customer data you need to ensure a certain level of security. 

We recommend Hetzner as host for your VPS. But you can also go to Services like Vultr or others.

Prerequisites

To follow this tutorial you need to walk through the first part of this tutorial series here:
Install WordPress on a VPS.

As soon as you got everything up and running, you can start here:

Update Server

Update Package Index

apt update && apt upgrade -y

Install Mautic

First let's create a MySQL database, a database user and give the user the necessary privileges. Change test1234 to a strong password. You can use a passwordgenerator for that.

mysql -u root
CREATE DATABASE mautic;
CREATE USER 'mautic'@'localhost' IDENTIFIED BY 'test1234';
GRANT ALL PRIVILEGES ON mautic.* TO 'mautic'@'localhost';
FLUSH PRIVILEGES;
exit

Now create a folder for your Mautic installation.

mkdir /var/www/html/mautic/

Download the latest stable Mautic. Check for the latest version number on Github

wget https://github.com/mautic/mautic/releases/download/4.3.1/4.3.1.zip && unzip 4.3.1.zip -d /var/www/html/mautic && rm 4.3.1.zip

Create the virtual hosts file for to tell the apache server where your Mautic is located and where to put the traffic. Here we use "nano" as editor:

nano /etc/apache2/sites-available/mautic.conf

Insert this into the file

<VirtualHost *:80>
    ServerAdmin your@emailaddress.com
    DocumentRoot /var/www/html/mautic/
    ServerName mautic.yourdomain.com

    <Directory /var/www/html/mautic/>
    Options +FollowSymlinks
    AllowOverride All
    Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Enable the new website on the server and restart apache

a2ensite mautic.conf && systemctl restart apache2

Enable the new website on the server and restart apache

certbot --apache --agree-tos --email youremail@yourdomain.com --redirect --hsts -d mautic.yourdomain.org

Make sure you see the success message from certbot. Otherwise something didn't work as it should. I explain that inside the video to this post as well - watch it (give it a like and comment).

Last thing to do is, to give read and write permissions to the apache user (www-data):

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

Ok. You're good to go!
Now open your Mautic within a browser and follow the onscreen instructions of the installer. These last steps are self-explanatory. If you want to have exact instructions how to do it, again, follow the video.

Comment down below if you have questions or found something what's not working for you. 
Until next time!

About the Author

Gründer und Marketing-Automation Nerd.
Er hilft Onlineshops voll automatisiert mehr zu verkaufen.
Mit der Lead & Sales Generator™ Methode generiert er qualifizierte Leads, gewinnt zufriedene Kunden und skaliert E-Commerce Businesses.
Außerdem liebt er Tee, Golf die Zeit mit seiner Familie und außergewöhnliche Geschäftskonzepte.

Leave a reply

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

  1. Hi Alex

    Thanks for yet another clear & concise tutorial. I have followed quite a few of yours over the last year or so. Mostly for n8n!

    I got a little concerned with this one though when I got to 4:50 (timecode) with the <VirtualHost *:80> tag. I have a full / live e-commerce website up and running on my DigtialOcean VPS droplet which I know runs on port 80 and I am wanting to run Mautic in a sub-domain on the same droplet. I am using CloudFlare for the DNS and My concern is that when I run the <VirtualHost *:80> tag in the console it might somehow adversely affect the e-commerce site that is already running. Is this the case? Or, will it work just fine and both e-Commerce site & Mautic installs will work just fine? Or, should I place Mautic on a separate droplet?

    Once again many thanks for all your help!

    1. Hi Andi,
      you can run it like it is. Important is to add the correct folder and domain into this virtual host file.
      Of course if you run it on another vps nothing can happen. But performance wise this is not necessary.

      Good luck,
      Alex

  2. Hi Great tutorials as always! Although I have a question. I have a VPS with my WordPress website on it. I have also installed Mautic via CLI in a sub-folder on the server. I have a number of forms that are collecting data from the website and sending emails via SES etc.. Everything working great! I now wish to move onto my second stage of the build and am feeling quite nervous about it! I am fairly new to Docker & using the CLI etc… Tho can find my way around!

    Here's what I wan to achieve…

    I wish to install "n8n" and something like "Budibase" on the same VPS again via CLI & Docker. But I am worried that I may break my website & Mautic installation. Will installing these with docker cause problems or will they work as stand-alones? and if they will work okay are their any standout importing things that I would need to keep an eye on? (Like ports etc…) Also, do you have any tutorials showing how to do this?

    And finally, I have snapshots & backups enabled for my VPS at server level (DigitalOcean) I also have daily backups for my WordPress install using ManageWP.com (great service) which allows me a very quick one click restore. So I'm wondering if there is a way of doing something similar with my Mautic and other dockers installs?

    Any help / advice much appreciated & keep up the great work!

    Andrew

    1. Hi Andrew,
      I don’t recommend mixing Mautic and WordPress on Apache plus containerized software. You could run everything in containers. This would work just fine.
      But to be honest: If you are not really fluent in maintaining a containerized structure, simply use different VPS for each program. That sums up to around 50-100 $/€ per month and gives you soooooo much more peace and reliability. If you once had the problem of running out of diskspace you will understand.

      Good luck with your choice
      Alex

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}