Mautic is a free and open source marketing automation software. It is written in PHP using the Symfony framework and uses MySQL/MariaDB to store its data. It provides many out of the box tools for marketing automation such as Social Media Marketing which allows you to engage the leads through social media. It also provides Contact management and email marketing tools. It allows you to create valuable forms for campaigns to collect information and generate reports using the data gathered.
In this tutorial, we will learn to install Mautic on CentOS 7.
Requirements
Mautic can be installed on systems with a small amount of RAM. You will also need a minimal installation of CentOS 7 with root access on it. If you are logged in as a non-root user, you can run sudo -i
to switch to root user.
Installing Mautic
Before installing any package it is recommended that you update the packages and repository using the following command.
yum -y update
Once you have your system updated, run the following command to install few packages on your server.
yum -y install httpd mariadb-server mariadb
The above command will install Apache web server with MariaDB database server. Now you will need to install PHP. Mautic supports both PHP 5.6 and 7.0. In this tutorial, we will learn to install both PHP 5.6 and 7.0. You must install only one version of PHP. The YUM repository contains PHP version 5.4 only, hence we will need to use the Webtatic repository to install a version of PHP 5.6 or 7.0. Run the following commands for installing EPEL repository as EPEL repository is required before we install Webtatic repository.
yum -y install epel-release
yum -y update
Now install Webtatic repository using the following commands.
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
To install PHP 5.6 and all the required PHP modules, run the following command.
yum -y install php56w php56w-cli php56w-xml php56w-pdo php56w-mcrypt php56w-imap php56w-posix php56w-intl php56w-mysqli php56w-pear php56w-imap php56w-curl php56w-gd
To install PHP 7.0 and all the required PHP modules, run the following command.
yum -y install php70w php70w-cli php70w-xml php70w-pdo php70w-mcrypt php70w-imap php70w-posix php70w-intl php70w-mysqli php70w-pear php70w-imap php70w-curl php70w-gd
Make sure that you are using only one of the PHP versions mentioned above. Once you have PHP installed, you can check the version of PHP using the following command.
php -v
You should get following output.
[root@liptan-pc ~]# php -v
PHP 7.1.1 (cli) (built: Jan 19 2017 20:35:16) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
Once PHP is installed, you will need to configure few thing in php.ini configuration. Open /etc/php.ini
using your favorite editor.
nano /etc/php.ini
If you do not have nano installed, you can install it using yum -y install nano
. Scroll down to find the following lines.
; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 128M
You can increase the memory_limit
to a higher amount so that the processing of PHP can also be done faster. Next find the following line,
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone =
Change the timezone according to your country. Save the file and exit from the editor.
Now install Composer using the following command. Composer is a dependency manager for PHP.
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/bin/composer
To start the Apache web server and enable it to start at boot time, run the following commands.
systemctl start httpd
systemctl enable httpd
Start MariaDB and enable it to start at boot time using the following commands.
systemctl start mariadb
systemctl enable mariadb
Now run the following command to secure your MariaDB installation.
mysql_secure_installation
It will run a small script which asks you to provide the root password for MariaDB. As we have just installed MariaDB, the root password is not set, just press enter to proceed further. It will ask you if you want to set a root password for your MariaDB installation, choose y
and set a strong password for the installation. It will further ask you for removing test databases and anonymous users. Most of the questions are self-explanatory and you should answer yes
or y
to all the questions.
To create a database we will need to login to MySQL command line first. Run the following command for same.
mysql -u root -p
This will prompt you for the password, provide the root password of MySQL which you have set earlier. Now run the following query to create a new database for your Mautic installation.
CREATE DATABASE mautic;
The above query will create a database named mautic
. For the database, you can use any name you prefer at the place of mautic
. Make sure that you use semicolon at the end of each query as the query always ends with a semicolon. Once the database is created you can create a new user and grant all the permissions to the user for the database. To create a new database user, run the following query.
CREATE USER 'mautic_user'@'localhost' IDENTIFIED BY 'StrongPassword';
The above query will create a user with username mautic_user
. You can use any preferred username instead of mautic_user
. Replace StrongPassword
with a strong password. Now provide the appropriate privileges to your database user over the database you have created. Run the following command.
GRANT ALL PRIVILEGES ON mautic.* TO 'mautic_user'@'localhost';
Now run the following command to immediately apply the changes on the database privileges.
FLUSH PRIVILEGES;
Exit from MySQL prompt using exit
command.
As we have all the dependencies ready, you can install Mautic using composer. Run the following command for same.
cd /var/www/
wget https://www.mautic.org/download/latest -O mautic.zip
The above command will download the latest version of the application archive in mautic.zip
file. Now unzip the file into /var/www/mautic
directory using the following command.
unzip mautic.zip -d mautic
If you don’t have unzip installed, you can run yum -y install unzip
. Now create a virtual host for your domain or subdomain which will be used to access the Mautic site. Run the following command for same.
nano /etc/httpd/conf.d/yourdomain.com.conf
Copy and paste the following lines into the file.
<VirtualHost *:80>
ServerAdmin me@liptanbiswas.com
ServerName yourdomain.com
DocumentRoot /var/www/mautic
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/mautic>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from All
</Directory>
TransferLog /var/log/httpd/yourdomain.com_access.log
ErrorLog /var/log/httpd/yourdomain.com_error.log
</VirtualHost>
In the above configuration, replace yourdomain.com
with your domain or subdomain.
Provide the ownership of the files to the Apache web server using the following command.
chown -R apache:apache /var/www/mautic
Now restart the Apache web server using the following command.
systemctl restart httpd
Now access the following URL through your web browser.
http://yourdomain.com
You will see following web interface of environment check. If you have followed the tutorial correctly, you should see that you have all the requirement satisfied to install Mautic.
HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/1112193432.png” alt=”” />
Click on Next Step button to proceed further. In this interface, you will need to provide the database credentials. Choose MySQL PDO as database driver. Don’t change the value of database host and port. Provide the name of the database with database username and password. Choose No for backup existing tables.
HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/726148226.png” alt=”” />
Click on Next Step button to proceed further. If the database credentials are correct, the installer will write the tables into the database. In next step of installation, you will need to create an administrative account.
HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/1203427402.png” alt=”” />
Provide the administrator details and click Next Step to proceed further. In the last step, you will need to configure the email.
HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/1714184244.png” alt=”” />
Choose the name and email who will send the outgoing emails. For email handling, you can choose to send immediately. Now choose the mailer transport application. You can choose PHP Mail, if you don’t have an SMTP server. The emails will be sent using phpmail()
function. Which is not recommended as the emails will likely go to spam folder. If you have SMTP server, you can provide the server details. You can also choose the many third party email agent for sending emails.
Once done, click on Next Step button to proceed further. The installation of Mautic is now finished, you can click on Proceed to Mautic to go to Mautic Dashboard after logging in.
HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/923864607.png” alt=”” />
Conclusion
In this tutorial, we have learned how to install Mautic Marketing Automation Software on CentOS 7. You can now deploy the application on your server to manage the marketing of your organization.