{"id":2477,"date":"2018-01-08T19:30:16","date_gmt":"2018-01-08T16:30:16","guid":{"rendered":"https:\/\/www.howtoforge.com\/tutorial\/how-to-install-mautic-marketing-automation-tool-on-centos-7\/"},"modified":"2018-01-08T19:30:16","modified_gmt":"2018-01-08T16:30:16","slug":"how-to-install-mautic-marketing-automation-tool-on-centos-7","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/how-to-install-mautic-marketing-automation-tool-on-centos-7\/","title":{"rendered":"How to Install Mautic Marketing Automation Tool on CentOS 7"},"content":{"rendered":"<p><strong>Mautic<\/strong> is an open source and self-hosted marketing automation tool for everyone. It allows you to grow up your business, monitor your website, create landing pages, create\u00a0campaigns for your business, manage contacts, and send marketing emails.<\/p>\n<p>In this tutorial, I will show you step-by-step how to install Mautic Marketing\u00a0Automation Platform on CentOS 7. It&#8217;s a web-based application, and we will be using the LEMP (Linux, Nginx, MySQL\/MariaDB, PHP) stack for our installation guide.<\/p>\n<h2 id=\"prerequisites\">Prerequisites<\/h2>\n<ul>\n<li>CentOS 7 server<\/li>\n<li>Root privileges<\/li>\n<\/ul>\n<h2 id=\"what-we-will-do\">What we will do<\/h2>\n<ol>\n<li>Install EPEL Repository<\/li>\n<li>Install Nginx Webserver<\/li>\n<li>Install and Configure MariaDB<\/li>\n<li>Install and Configure PHP-FPM<\/li>\n<li>Download Mautic<\/li>\n<li>Configure Nginx Virtual Host for Mautic<\/li>\n<li>Mautic Web-based Installation<\/li>\n<\/ol>\n<h2 id=\"step-install-epel-repository\">Step 1 &#8211; Install EPEL Repository<\/h2>\n<p>The first thing we must do is to add new EPEL repository to the system.<\/p>\n<p>Add new EPEL repository to the CentOS 7 system using the following command.<\/p>\n<p class=\"command\">yum -y install epel-release<\/p>\n<p>New EPEL repository has been installed and added to the system.<\/p>\n<h2 id=\"step-install-nginx\">Step 2 &#8211; Install Nginx<\/h2>\n<p>Install the Nginx web server from the EPEL repository using the following yum command.<\/p>\n<p class=\"command\">yum -y install nginx<\/p>\n<p>After the installation is complete, start the service and enable it to launch at system boot.<\/p>\n<p class=\"command\">systemctl start nginx<br \/>systemctl enable nginx<\/p>\n<p>Now check it using the netstat command.<\/p>\n<p class=\"command\">netstat -plntu<\/p>\n<p>And make sure you get the result as shown below.<\/p>\n<p><a class=\"fancybox\" id=\"img-1\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_install_mautic_marketing_automation_tool_on_centos_7\/big\/1.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/01\/how-to-install-mautic-marketing-automation-tool-on-centos-7.png\" alt=\"Check if nginx is working with the netstat command\" width=\"500\" height=\"241\" title=\"\"><\/a><\/p>\n<h2 id=\"step-install-and-configure-mariadb\">Step 3 &#8211; Install and Configure MariaDB<\/h2>\n<p>Mautic offers support only for the MySQL database with min version 5.5.3. For this guide, we will be using the mariadb-server 10.0 based on MySQL 5.5.<\/p>\n<p>Install the mariadb database using the yum command below.<\/p>\n<p class=\"command\">yum -y install mariadb-server<\/p>\n<p>After the installation is complete, start the mariadb service and enable it to launch at boot time.<\/p>\n<p class=\"command\">systemctl start mariadb<br \/>systemctl enable mariadb<\/p>\n<p>For security reasons, we need to configure the mysql root password.<\/p>\n<p>Run the &#8216;mysql_secure_installation&#8217; command as shown below.<\/p>\n<p class=\"command\">mysql_secure_installation<\/p>\n<p>And you will be asked about some mysql configuration &#8211; see below.<\/p>\n<pre class=\"system\">Set root password? [Y\/n] Y<br\/>Remove anonymous users? [Y\/n] Y<br\/>Disallow root login remotely? [Y\/n] Y<br\/>Remove test database and access to it? [Y\/n] Y<br\/>Reload privilege tables now? [Y\/n] Y<\/pre>\n<p>The MariaDB installation has been completed.<\/p>\n<p>Next, we need to add new database and user for the Mautic installation. We will create a new database named &#8216;mautic&#8217; with user &#8216;mauticuser&#8217; and password &#8216;aqwe123&#8217;.<\/p>\n<p>Login to the mysql server using the myql command.<\/p>\n<p class=\"command\">mysql -u root -p<\/p>\n<p>Now create new database and user using the mysql queries below.<\/p>\n<p class=\"command\">create database mautic;<br \/>grant all on mautic.* to &#8216;mauticuser&#8217;@&#8217;localhost&#8217; IDENTIFIED BY &#8216;aqwe123&#8217;;<br \/>flush privileges;<br \/>exit;<\/p>\n<p><a class=\"fancybox\" id=\"img-2\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_install_mautic_marketing_automation_tool_on_centos_7\/big\/2.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/01\/how-to-install-mautic-marketing-automation-tool-on-centos-7-1.png\" alt=\"Create mautic database\" width=\"500\" height=\"309\" title=\"\"><\/a><\/p>\n<p>The MySQL database and user for mautic installation has been created.<\/p>\n<h2 id=\"step-install-and-configure-phpfpm\">Step 4 &#8211; Install and Configure PHP-FPM<\/h2>\n<p>Mautic requires PHP 5.6.19 (at-least) for installation. And for this guide, we will be using PHP-FPM 7.0 from the &#8216;webtatic&#8217; repository.<\/p>\n<p>Add new &#8216;webtatic&#8217; repository for PHP 7.<\/p>\n<p class=\"command\">rpm -Uvh https:\/\/mirror.webtatic.com\/yum\/el7\/webtatic-release.rpm<\/p>\n<p>Now install PHP and PHP-FPM with all required extensions using the following yum command.<\/p>\n<p class=\"command\">yum -y install php70w-fpm php70w-mbstring php70w-xml php70w-mysql php70w-common php70w-gd php70w-json php70w-cli php70w-curl php70w-zip php70w-xml php70w-mcrypt php70w-imap php70w-intl php70w-process<\/p>\n<p>PHP and PHP-FPM with all required extensions have been installed. Next, we need to configure PHP and PHP-FPM.<\/p>\n<p>For this, we need to edit the &#8216;php.ini&#8217; file and edit the php-fpm pool configuration file &#8216;www.conf&#8217;.<\/p>\n<p>Edit the &#8216;php.ini&#8217; file using <a href=\"https:\/\/www.howtoforge.com\/vim-basics\" target=\"_blank\" rel=\"noopener noreferrer\">vim editor<\/a>.<\/p>\n<p class=\"command\">vim \/etc\/php.ini<\/p>\n<p>Uncomment the &#8216;date.timezone&#8217; line and set the default time zone to &#8216;UTC&#8217;.<\/p>\n<pre class=\"system\">date.timezone = \"UTC\"<\/pre>\n<p>Uncomment the &#8216;cgi.fix_pathinfo&#8217; line and change the value to &#8216;0&#8217;.<\/p>\n<pre class=\"system\">cgi.fix_pathinfo = 0<\/pre>\n<p>For the PHP session path configuration, uncomment the &#8216;session.save_path&#8217; line and change it to the &#8216;\/var\/lib\/php\/session&#8217; directory as below.<\/p>\n<pre class=\"system\">session.save_path = \"\/var\/lib\/php\/session\"<\/pre>\n<p>Save these changes and exit the editor.<\/p>\n<p>Now, edit the PHP-FPM pool configuration file &#8216;www.conf&#8217; using vim.<\/p>\n<p class=\"command\">vim \/etc\/php-fpm.d\/www.conf<\/p>\n<p>Change the default user and group for PHP-FPM to the &#8216;nginx&#8217; user.<\/p>\n<pre class=\"system\">user = nginx<br\/>group = nginx<\/pre>\n<p>Instead of using the system port, PHP-FPM will be running under the sock file. Change the &#8216;listen&#8217; line as shown below.<\/p>\n<pre class=\"system\">listen = \/var\/run\/php-fpm\/php-fpm.sock<\/pre>\n<p>Now set the owner of the sock file to the &#8216;nginx&#8217; user with\u00a0permission &#8216;660&#8217;.<\/p>\n<pre class=\"system\">listen.owner = nginx<br\/>listen.group = nginx<br\/>listen.mode = 0660<\/pre>\n<p>That&#8217;s it for this file. Save and exit.<\/p>\n<p>Next, create a new directory for the PHP session file and change the owner to the &#8216;nginx&#8217; user.<\/p>\n<p class=\"command\">mkdir -p \/var\/lib\/php\/session\/<br \/>chown -R nginx:nginx \/var\/lib\/php\/session\/<\/p>\n<p>Now start the php-fpm service and enable it to launch at system boot.<\/p>\n<p class=\"command\">systemctl start php-fpm<br \/>systemctl enable php-fpm<\/p>\n<p>PHP and PHP-FPM have been installed, and the latter is running under the sock file.<\/p>\n<p>Check it using the netstat command below.<\/p>\n<p class=\"command\">netstat -pl | grep php-fpm.sock<\/p>\n<p>And you should get the result as below.<\/p>\n<p><a class=\"fancybox\" id=\"img-3\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_install_mautic_marketing_automation_tool_on_centos_7\/big\/3.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/01\/how-to-install-mautic-marketing-automation-tool-on-centos-7-2.png\" alt=\"Configure PHP\" width=\"500\" height=\"168\" title=\"\"><\/a><\/p>\n<h2 id=\"step-download-mautic\">Step 5 &#8211; Download Mautic<\/h2>\n<p>Create a new directory &#8216;\/var\/www&#8217; and enter it.<\/p>\n<p class=\"command\">mkdir -p \/var\/www<br \/>cd \/var\/www\/<\/p>\n<p>Now download the mautic source code using wget, then extract it to the &#8216;mautic&#8217; directory using the unzip command.<\/p>\n<p class=\"command\">wget https:\/\/www.mautic.org\/download\/latest<br \/>unzip latest -d mautic\/<\/p>\n<p><strong>Note: <\/strong>If you get a result saying &#8216;unzip command not found&#8217;, install the package using the following yum command.<\/p>\n<p class=\"command\">yum -y install unzip<\/p>\n<p>Now change the ownership for &#8216;mautic&#8217; directory to the &#8216;nginx&#8217; user and group.<\/p>\n<p class=\"command\">sudo chown -R nginx:nginx mautic\/<\/p>\n<p>Mautic source code has been downloaded, and the &#8216;\/var\/www\/mautic&#8217; directory will be the webroot directory for mautic.<\/p>\n<h2 id=\"step-configure-nginx-virtual-host-for-mautic\">Step 6 &#8211; Configure Nginx Virtual Host for Mautic<\/h2>\n<p>For this guide, we&#8217;re using Nginx instead of Apache web server. In this step, we will configure the Nginx virtual host for our mautic installation on the CentOS 7 system.<\/p>\n<p>Goto the &#8216;\/etc\/nginx&#8217; directory and create a new file named &#8216;mautic.conf&#8217; under the &#8216;conf.d&#8217; directory using the vim editor.<\/p>\n<p class=\"command\">cd \/etc\/nginx\/<br \/>vim conf.d\/mautic.conf<\/p>\n<p>Paste the following Nginx virtual host configuration there.<\/p>\n<pre class=\"system\" readability=\"15\">server {<br\/>\u00a0\u00a0\u00a0 listen 80;<br\/>\u00a0\u00a0\u00a0 listen [::]:80;<br\/>\u00a0\u00a0\u00a0 server_name mautic.hakase-labs.co;<p>\u00a0\u00a0\u00a0 root \/var\/www\/mautic;<br\/>\u00a0\u00a0\u00a0 index index.php index.html index.htm index.nginx-debian.html;<\/p><p>\u00a0\u00a0\u00a0 location \/ {<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0 try_files $uri $uri\/ =404;<br\/>\u00a0\u00a0\u00a0 }<\/p><p>\u00a0\u00a0\u00a0 location ~ .php$ {<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0 include fastcgi.conf;<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0 fastcgi_pass unix:\/var\/run\/php-fpm\/php-fpm.sock;<br\/>\u00a0\u00a0\u00a0 }<\/p><p>\u00a0\u00a0\u00a0 location ~* ^\/index.php {<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0 fastcgi_split_path_info ^(.+.php)(\/.+)$;<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0 fastcgi_pass unix:\/var\/run\/php-fpm\/php-fpm.sock;<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0 fastcgi_index index.php;<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0 include fastcgi_params;<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0 fastcgi_buffer_size 128k;<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0 fastcgi_buffers 256 16k;<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0 fastcgi_busy_buffers_size 256k;<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0 fastcgi_temp_file_write_size 256k;<br\/>\u00a0\u00a0\u00a0 }<br\/>}<\/p><\/pre>\n<p>That&#8217;s it. Save and exit.<\/p>\n<p>Now test the nginx configuration and make sure there is no error. Then restart the nginx service.<\/p>\n<p class=\"command\">nginx -t<br \/>systemctl restart nginx<\/p>\n<p>Nginx virtual host configuration for mautic has been completed.<\/p>\n<p><a class=\"fancybox\" id=\"img-4\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_install_mautic_marketing_automation_tool_on_centos_7\/big\/4.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/01\/how-to-install-mautic-marketing-automation-tool-on-centos-7-3.png\" alt=\"Configure Nginx, test and apply the config\" width=\"500\" height=\"163\" title=\"\"><\/a><\/p>\n<h2 id=\"step-mautic-webbased-installation\">Step 7 &#8211; Mautic Web-based installation<\/h2>\n<p>Open your web browser and visit the mautic domain name, mine is: http:\/\/mautic.hakase-labs.co<\/p>\n<p>You will be redirected to the mautic installation page. There, make sure all the extensions and configuration has no error.<\/p>\n<p><a class=\"fancybox\" id=\"img-5\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_install_mautic_marketing_automation_tool_on_centos_7\/big\/5.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/01\/how-to-install-mautic-marketing-automation-tool-on-centos-7-4.png\" alt=\"Mautic web installer\" width=\"500\" height=\"184\" title=\"\"><\/a><\/p>\n<p>Click the &#8216;<strong>Next Step<\/strong>&#8216; button to continue.<\/p>\n<p>Now you will see the page about the database configuration.<\/p>\n<p>Type your database name, database user, and password as below.<\/p>\n<p><a class=\"fancybox\" id=\"img-6\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_install_mautic_marketing_automation_tool_on_centos_7\/big\/6.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/01\/how-to-install-mautic-marketing-automation-tool-on-centos-7-5.png\" alt=\"Set the database details for Mautic\" width=\"500\" height=\"282\" title=\"\"><\/a><\/p>\n<p>And click the &#8216;<strong>Next Step<\/strong>&#8216; button.<\/p>\n<p>Next, we need to create a new admin account for Mautic.<\/p>\n<p>Type your admin user, email, and password.<\/p>\n<p><a class=\"fancybox\" id=\"img-71\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_install_mautic_marketing_automation_tool_on_centos_7\/big\/71.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/01\/how-to-install-mautic-marketing-automation-tool-on-centos-7-6.png\" alt=\"Add a admin user\" width=\"500\" height=\"279\" title=\"\"><\/a><\/p>\n<p>Click &#8216;<strong>Next Step<\/strong>&#8216; button.<\/p>\n<p>Next up is the email configuration &#8211; you can choose one option, or you can do this configuration later.<\/p>\n<p><a class=\"fancybox\" id=\"img-8\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_install_mautic_marketing_automation_tool_on_centos_7\/big\/8.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/01\/how-to-install-mautic-marketing-automation-tool-on-centos-7-7.png\" alt=\"Email configuration\" width=\"500\" height=\"244\" title=\"\"><\/a><\/p>\n<p>Click the &#8216;<strong>Next Step<\/strong>&#8216; button again.<\/p>\n<p>Now, you will get the admin login page.<\/p>\n<p>Type your admin user and password and click the &#8216;Login&#8217; button.<\/p>\n<p><a class=\"fancybox\" id=\"img-9\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_install_mautic_marketing_automation_tool_on_centos_7\/big\/9.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/01\/how-to-install-mautic-marketing-automation-tool-on-centos-7-8.png\" alt=\"Login to Mautic\" width=\"500\" height=\"263\" title=\"\"><\/a><\/p>\n<p>You&#8217;ll be taken to the Mautic admin dashboard as shown below.<\/p>\n<p><a class=\"fancybox\" id=\"img-10\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_install_mautic_marketing_automation_tool_on_centos_7\/big\/10.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/01\/how-to-install-mautic-marketing-automation-tool-on-centos-7-9.png\" alt=\"Mautic Marketing Automation Tool\" width=\"500\" height=\"267\" title=\"\"><\/a><\/p>\n<p>The Mautic marketing automation tool installation on CentOS 7 with Nginx web server has been completed successfully.<\/p>\n<h2 id=\"reference\">Reference<\/h2>\n<div>\n<p><b>Share this page:<\/b><\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Mautic is an open source and self-hosted marketing automation tool for everyone. It allows you to grow up your business, monitor your website, create landing pages, create\u00a0campaigns for your business, manage contacts, and send marketing emails. In this tutorial, I will show you step-by-step how to install Mautic Marketing\u00a0Automation Platform on CentOS 7. It&#8217;s a &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-2477","post","type-post","status-publish","format-standard","hentry","category-36"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/2477","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=2477"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/2477\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=2477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=2477"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=2477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}