Install Apache, PHP 7.2 and MySQL on CentOS 7 (LAMP)

1. Update and install MySQL / MariaDB

yum -y update
rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY*
yum -y install epel-release
yum -y install mariadb-server mariadb
systemctl start mariadb.service
systemctl enable mariadb.service
mysql_secure_installation

2. Installing Apache, PHP 7.2 and phpMyAdmin


yum -y install httpd
systemctl start httpd.service
systemctl enable httpd.service
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum -y install yum-utils
yum -y update
yum-config-manager --enable remi-php72
yum -y install php php-opcache
systemctl restart httpd.service
yum search php
yum -y install php-mysqlnd php-pdo
yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel
systemctl restart httpd.service
yum -y install phpMyAdmin
systemctl restart httpd.service

Edit phpMyAdmin.conf

vi /etc/httpd/conf.d/phpMyAdmin.conf


[...]
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8


<IfModule mod_authz_core.c>
# Apache 2.4
# <RequireAny>
# Require ip 127.0.0.1
# Require ip ::1
# </RequireAny>
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
[...]

Change the authentication in phpMyAdmin from cookie to http

vi /etc/phpMyAdmin/config.inc.php


[...]
$cfg['Servers'][$i]['auth_type'] = 'http'; // Authentication method (config, http or cookie based)?
[...]

Restart Apache:


systemctl restart httpd.service

Disable selinux
View Selinux Status:

getenforce

Disable SELinux :

setenforce 0

more about selinux => https://www.amitnepal.com/selinux-tutorial/