This is a basic but production-ready Mautic installation tutorial, that you simply can run during a SMALL production environment with real data from your customers. This tutorial keeps everything as simple as possible but would require some basic understanding of the Linux instruction .
If you’re new Mautic or the Linux instruction , first do this simpler Mautic tutorial: Mautic Installation in 3 Simple Steps, it’s the only thanks to start and therefore the probability of anything going sideways is minimal. It’s designed to offer you a fast success using the instruction so you’ll have a simple victory and gain the arrogance to later advance with this second part.
Mautic Installation
What is required to Setup Mautic?
What you need is simply is:
- A VPS Server to install Mautic on.
- Domain Name to use with our setup.
.1 Get a Domain Name.
Getting a website is as simple as eating a bit of cake. you would like to travel to any Domain registrar company like BlueHost, Godaddy, Enom, Freenom, Namecheap… and Buy a website Name, you’ll even get one for 1$ per annum.
I do recommend to urge a .com domain that reflects your business. and if you have already got one, as i feel so, you’ll just skip this, and still get a VPS Server.
How to Buy Bluehost Hosting Plan in 4 Simple Steps:
Step 1: Visit Bluehost by clicking HERE. This will take you to the below-mentioned welcome page of the company, where you are advised to read the terms and conditions before proceeding to the next step.
Step 2: Set up your domain name, which is your website’s permanent address on the Internet. For example, our domain name is allintutorial.com.
Once you have decided on a domain name, type it into the search function under Create a New Domain and select Next.
Step 3: The next stage is the “sign in” into your account page, which can be done if you have already opened an account with Bluehost before the period of undertaking the process. If you don’t have an account, then you can click on “create an account” which is free and easy to create.
Step 4: After logging into your account or signing up, the next stage is to make the required payment using the method that pleases you. Payment can be made either by credit card, debit card, direct bank deposit among others.
Note : Any information provided will be safeguarded from theft and third party.After these steps, you are ready to go on with creating your dream website.
2 Get a VPS Server.
Now, Let’s get our VPS server to set up MailWizz on.
What company should I use?
You can use whatever company you would like to shop for a VPS Server, during this guide i will be able to be using Digital Ocean Cloud services.
Feel free to use any VPS company you would like , It’s up to you!
You can also check in on DigitalOcean through the coupon link below to urge free 100$ to check everything free.
So after you signup on Digital Ocean or any other VPS company, just create a Server with the following specifications:
- Ubuntu 16/18 x64 as your operating system.
- You can start with 1 CPU/ 1 GB RAM (You can resize later).
Point Domain to VPS.
Before we continue you need to point your domain or subdomain to your VPS IP address.
In my case, I will create a Subdomain “allintutorial.com” and point it to my Oracle VPS IP address.
Done?
OK so now we have a Domain and a VPS server, Let’s Start the installation.
Connect to your VPS server using any SSH client like putty.
And Lets Install Apache, PHP, and MySQL which are the pre requests for hosting any PHP application like Mautic.
Here I’m trying to show everything so the Guide can cover any scenario:
Now, I will go back and show you how to start from scratch if you have a clean Ubuntu installation and go manually with each step.
Pre-Installation
In order to possess a secure server, you’ve got to start out securing it even before you begin that server.
In the last step, you’ll be enabling SSL, so as to try to to so, you’ll need a legitimate domain pointing to your Mautic VPS, so because DNS propagation takes a while , you ought to start by creating a replacement DNS record for your Mautic Installation now, for example: mautic.yourdomain.com
The first thing you would like to try to to isn’t TO USE A PASSWORD but a KEY instead at the time you create (buy) your new VPS.
Having a key greatly increases your security against brute force attacks and has also a really nice extra advantage: you’ll never, ever need to type your password to access your VPS.
Create a personal and Public Key pair:
Keys and passwords aren’t that different, however, a key’s 256 or 512 or 1024 characters long (up to 4096 currently) and is meant to be communicated during a safer fashion and stored only in your computer (preferably encrypted).
I know, creating a personal and public key pair isn’t that fun the primary time you are doing it, I remember how confused i used to be , back in 2008, once I tried to launch my first AWS instance, a key was required… Luckily today there are many good tutorials, including several ones from the DO blog which will get you ready in no time.
If you create your key beforehand, you’ll be ready to use it when creating a replacement droplet and every one the key setup process are going to be automated for you, if you would like to reuse an existing VPS that was previously employing a password, you’ll need to install the key within the droplet manually by yourself. altogether cases, this page has all the knowledge you would possibly require: https://www.digitalocean.com
Having a key increases your security almost the maximum amount as all the remainder of the steps during this tutorial together. If despite that, for whatever reason you select to use a password, make it a minimum of 32 random characters long.
Another vital step before you begin installing Mautic is securing your new server with a firewall.
Configuring a firewall:
There are 2 main options for this, external firewall and internal firewall. An external firewall is provided by your cloud company, the interior firewall is one you found out inside your VPS.
1) Using an external firewall: Most cloud providers will provide you with an external firewall, most likely for free of charge . External firewalls on AWS, Google Cloud and other top tier providers are excellent. the most advantage of employing a good external firewall is that you simply can found out your firewall rules before you even start your new VPS, hence protecting it from the very instant of its creation.
Digital Ocean’s firewall is comparatively simple to configure, however, you can’t assign a firewall rule to a replacement droplet before it exists, hence leaving the droplet unprotected for the jiffy that it takes to configure it. this is often an enormous design flaw that i’m sure they’re going to fix in time , but within the mean-time, their firewall is not any better than an indoor firewall.
Since every external firewall works slightly differently than the remainder , i’m not getting to detail the steps, each cloud provider has its own tutorials for his or her own firewalls, check those. Here is the way to found out a firewall on DO.
2) Using an indoor firewall: this feature is easier and faster to configure, it does the work perfectly in our situation, and it’s an honest practice to line it up albeit you furthermore may use an external one.
Ubuntu comes with UFW (Uncomplicated FireWall) preinstalled, which makes securing your VPS a snap.
The UFW closes all ports by default, so basically, it closes all possible points of entry to your server, making it quite secure. Since all ports are going to be closed, unless we “punch a hole” (open a port) on the firewall, nobody goes to be ready to reach your VPS, not even you. Since we’re using the SSH protocol to attach to our server, we’ll got to open port 22 before we activate the firewall or we might be unable to succeed in our own VPS.
To configure the firewall so port 22 is open:
sudo su
ufw allow 22
If you decided to enable an external firewall this is the time to open port 22 ALSO on the external firewall. In fact, every time we open a port on the internal firewall with the ufw allow command, you have to remember to open the same port on the external firewall.
Now we can start the firewall:
ufw enable
OK, the pre-installation is now complete, we can proceed with the Mautic installation.
Installing Mautic:
Most of the subsequent steps are precisely the same as within the first tutorial, if you already followed it, you’ll skip on to the “Securing your MySQL server” section below.
Make sure our server is up so far by updating the Ubuntu installation.
apt update && apt upgrade -y
Installing all the required packages (Applications) that are needed to run Mautic.
apt install apache2 libapache2-mod-php php unzip mariadb-server php-xml php-mysql php-imap php-zip php-intl php-curl ntp -y
Activating certain Apache 2 modules that are not active by default after installation.
a2enmod rewrite
Downloading and uncompressing the Mautic files.
cd /var/www/html
wget https://github.com/mautic/mautic/releases/download/2.15.3/2.15.3.zip
unzip 2.15.3.zip
rm 2.15.3.zip
Making sure Apache and Mautic, both have ownership and write access to the files.
chown -R www-data:www-data /var/www/html
chmod -R 775 /var/www/html
Configuring Apache:
wget https://mauteam.org/wp-content/uploads/2019/10/000-default.txt
mv 000-default.txt /etc/apache2/sites-available/000-default.conf
Creating a database for Mautic.
mysql -u root
This command will connect you to your database, the only difference you will notice is that the text before your command prompt will change to “MariaDB [(none)]>”
CREATE DATABASE mautic DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
GRANT ALL ON mautic.* TO 'root'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
EXIT;
After the “EXIT;” command you will return to the normal mode…
Securing your MySQL server:
Securing your MariaDB (MySQL) server is very simple and can be done with just one command, this is just a very basic security script, that will ask you some questions in order to make your server more secure but keep it usable for your purposes. For this type of setup, it will perfectly do the job.
mysql_secure_installation
This will start the interactive script, you just have to answer the questions with these answers:
Enter current password for root (enter for none): (enter)
Change the root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
You are done, as you see, you basically just have to answer yes to all questions and let the script do the work for you.
Almost done, the Mautic server is now installed and secured, before we run the Mautic Configuration Wizard, we need to open port 80 on the firewall to be able to connect to our server from a browser:
ufw allow 80
service apache2 reload
Run the Mautic Configuration Wizard.
Mautic is now ready to be configured, you just need to use a browser, like Chrome or Firefox, and navigate to the IP of your server.
Here’s an excerpt of your configuration for the Mautic Installation Wizard
- Database driver: MySQL PDO
- Database Host: localhost
- Database port: 3306
- DB name: Mautic
- Database Table Prefix: Leave empty
- DB User: root
- DB Password: password
- Backup existing tables: No
If you need help with the wizard steps, check this other post with step by step instructions:
Mautic Installation: The Configuration Wizard
Enable HTTPS with certbot
It’s important to enable secure connections to the users connecting to Mautic from a browser, Certbot is about the only thanks to enable SSL on your server.
Before having the ability to proceed with enabling HTTPS, you would like to possess a website enabled for Mautic, so if your domain is named yourdomain.com, you’ll got to create a subdomain for Mautic, for example: mautic.yourdomain.com. this is often usually configured within the instrument panel of your domain registrar (the website where you bought your domain). If somebody else is doing it for you, just ask them to: “Add an A record for mautic.yourdomain.com” in fact , change “yourdomain.com” for your real name . they’re going to ask you something like, “What’s the IP?”, or even “Where do I point the record to?” Whatever they formulate the question, the solution is usually the IP of your VPS 😉
OK then, so Certbot is another automated script that does tons of labor for you and automatically installs the specified certificates and automatically modifies your Apache 2 configuration so you don’t need to , it also runs a verification process that needs port 80 to be open so as to form an invitation from the Open SSL servers to verify your ownership of the server, and through the installation process we’ll want to force SSL redirection, hence we’ll also need access to port 443.
Since we already had open port 80 before, we’ll now open port 443 for secure https connections.
ufw allow 443
ufw status
To install required packages for Certbot to work, since Certbot is not found in the default Ubuntu repositories, we will first need to add
the Certbot repository to your server’s list:
sudo add-apt-repository ppa:certbot/certbot
Since we added a new repo, it’s important to make sure all packages are up to date:
apt update && apt upgrade -y
We can now finally install Cerbot for Apache 2:
sudo apt-get install python-certbot-apache
Now let’s launch Certbot’s interactive setup:
certbot --apache -d mautic.yourdomain.com
Now answer the questions and certbot will take care of the rest…
Once the setup is done, you’ll want to enable automatic renewal of the certificate
sudo certbot renew --dry-run
You are good to go, open your browser and try to connect to your Mautic server with HTTPS.
Install the cron jobs.
Mautic is now working and you can navigate to all the sections and explore, but if you want working segments and campaigns you will also need to install the Mautic cron jobs:
wget https://mauteam.org/wp-content/uploads/2019/10/cron-jobs.txt
crontab cron-jobs.txt
Done! easiest method to put in cron jobs, ever…
Got any questions? stuck on one among the steps? anything not working as planned?
Don’t hesitate to invite the comments here below!!