Published on 2020-01-20· Updated on 2023-09-06
Mautic is a very popular email marketing and lead management software that can be used to create customized email templates and email campaigns. Here are the detailed steps you need to follow to install Mautic on your Linux server - Centos 7.
$ cd var/www/html/
$ sudo mkdir mautic $ cd mautic
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.15.3.zip
Enter the following commands in your local machine download file location
$ scp -r 2.15.3.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.
$ sudo unzip mautic.zip
If you don't have unzip installed you can install it by using
$ sudo yum install unzip
$ sudo rm -rf mautic.zip
$ sudo yum -y install php7-fpm php-mbstring php-xml php-mysql php-common php-gd php-json php-cli php-curl php-zip php-xml php-mcrypt php-imap php-intl php-process
$ wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
$ sudo rpm -ivh mysql57-community-release-el7-9.noarch.rpm
$ sudo yum install mysql-server
$ sudo systemctl start mysqld
- 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 enter the root password you can enter the copied password you've got in the previous step
- After entering the password you will be prompted to enter a new MySQL password.
- Enter a new 12 character password with uppercase lowercase letters, numerical and a special character
- You will now be prompted with multiple questions on how to set up the MySQL installation. You can say yes to all except if asked to change the password again.
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;
(You can install Nginx or Apache server according to your needs)
- Nginx:
$ sudo yum install nginx $ sudo systemctl start nginx $ sudo systemctl enable nginx
$ 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 127.0.0.1:9000; 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/php5-fpm.sock;
Note: If you are unclear on which value has to be set, you can check this in www.conf file.
$ vim /etc/php-fpm.d/www.conf
Search for the listen parameter.
- Apache:
$ sudo yum install httpd $ sudo systemctl start httpd $ sudo systemctl enable httpd
$ 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
You may get this error if some folder permissions are not set
This error might exist because your Mautic folder user group is not the same as your running php-fpm instance.
Depending upon your user group you can set the following permissions.
Run the following commands to set permissions for Mautic installation
If your php-fpm user group is www-data
$ sudo chown -R www-data:www-data /var/www/html/mautic/
If it is nginx you have to set permissions like this
$ sudo chown -R nginx:nginx /var/www/html/mautic/
And for user group apache add
$ sudo chown -R apache:apache /var/www/html/mautic/
You can check user group of php-fpm file by using
$ ps -ef | grep fpm
Or you can check php-fpm config file by
$ vim /etc/php-fpm.d/www.conf
In this file check the user option
Set the Mautic directory permission
$ sudo chmod -R 755 /var/www/html/mautic/
Note: Also make sure that your PHP session path folder should also be added to the user group
$ vim /etc/php-fpm.d/www.conf
In this file check the php_value[session.save_path] attribute
Even by following the above steps you are still having issues use the following commands (For Apache users only)
sudo chcon -t httpd_sys_rw_content_t /var/www/html/mautic/app/logs -R sudo chcon -t httpd_sys_rw_content_t /var/www/html/mautic/app/cache -R sudo chcon -t httpd_sys_rw_content_t /var/www/html/mautic/app/config -R
Make sure you have all the PHP dependencies installed
Now you can go back to the browser and refresh the window and hopefully you have solved this error. If you are still getting the error screen you can try to debug using the Nginx error logs at.
/var/log/nginx/error.log
If you haven’t yet set up Mautic, you will be redirected to the installation panel.
If all the dependencies are matched for the installation of Mautic you will be shown a Ready to install prompt on the screen, Else the dependencies that are not satisfied will be listed on the panel.
If there are any minor bugs that need to be fixed they will be listed in the recommendations section. You can opt for fixing these recommendations.
After you have fixed the stated dependencies click on [Next Step] button.
Click on the Next Step button.
Note:- If you are having a problem with the blank Database Driver dropdown please make sure that you have all PHP dependencies installed you might haven't installed mysqlmd php dependency.
Enter the Admin credentials, these credentials will be used when logging in the Mautic user panel.
The email address you enter will be used for password resets.
Click on the Next Step button.
Before you proceed to the next step you will need our Pepipost SMTP server credentials.
Please check the screenshot provided below for reference:
You will use these credentials to set up our SMTP configuration in the next step
Now back at the Mautic installation screen
In [Who should the email be sent as?] section there are two parameters
in [How should email be spooled and delivered?] section you will be setting the following options.
In Email handling, there are two options.
Mailer transport: Select [Other SMTP Server]
Server: smtp.pepipost.com
Port: 25 [or you can set the port to 587 if 25 is blocked at your sever]
Encryption: TLS
Authentication mode: Login
Username: Your_Pepipost_username
Password: Your_Pepipost_password
Click on Next step
After this, you will be redirected to the login panel. Log in with your credentials and with this you will move on to the next step
This is how your dashboard will look
Cronjob is nothing but a scheduler that runs the specified path at a specified interval. Every action and updates done in the Mautic is mostly done by the Cron job running at regular intervals, If they are not set most of the Mautic's functionalities won't work.
For installing Cron jobs use the following command.
$ yum install cronie
Follow these steps to add Mautic Cron jobs.
$ sudo crontab -e
Add the following Crons
*/5 * * * * php /var/www/html/mautic/app/console mautic:segments:update >> /var/log/crontab.log 2>&1 */10 * * * * php /var/www/html/mautic/app/console mautic:campaigns:update >> /var/log/crontab.log 2>&1 */12 * * * * php /var/www/html/mautic/app/console mautic:campaigns:trigger >> /var/log/crontab.log 2>&1 */15 * * * * php /var/www/html/mautic/app/console mautic:emails:send >> /var/log/crontab.log 2>&1
Based on the Cron set up your contacts, campaign and emails will be triggered, you might want to change the time interval of all of these Cron jobs based on your requirements.
Note: It is recommended that the Cron job interval doesn't collide with each other so keep the Cron timings unique.
There are two steps for creating new contacts
1. Single contact creation
2. Bulk Upload email list
This will open the Campaign panel in which all the campaign status is represented in a graphical format in which you can track the emails that are being sent.
With this, your campaign is ready to send emails from your imported segment.
After some time as the Cron runs, you will be able to see the emails being populated in the dashboard.
You can check the progress of your campaign in the campaign panel.
By following the above-mentioned steps you are now ready to send emails through the Mautic platform. You are now able to upload an email list, create an email body, filter the email leads with segments and send emails using the Pepipost SMTP server.
Netcorecloud's toolkit is the solution to all your email problems.
Netcore connects & unifies your data across all sources, connects to your marketing channels and provides you with control over AI Powered automation and personalization.
Hitesh Pandey💻
Full Stack Developer, Pepipost
🥑 Developer Evangelist | 🥇Email Geek