In this write up will will look into installing phpMyadmin web based front end for MariaDB and MySQL databases on CentOS7. In our example we will provide ip address 192.168.0.11 and 192.168.0.12 on local network access to phpMyadmin on web server websrv1 while denying access to everyone else.
We assume LAMP stack was already deployed and we have functioning Linux, Apache, PHP, MySQL web server
1. First we need to add EPEL repository to our web server.
websrv1# yum install epel-release
2. Now we install phpMyadmin package with yum
websrv1# yum install phpmyadmin
3. Lets edit default phpMyadmin configuration file and add IP addresses of workstations that will be allowed to access phpMyadmin website. We will need to edit /etc/httpd/conf.d/phpMyadmin.conf file
websrv1#vi /etc/httpd/conf.d/phpMyAdmin.conf # phpMyAdmin - Web based MySQL browser written in php # # Allows only localhost by default # # But allowing phpMyAdmin to anyone other than localhost should be considered # dangerous unless properly secured by SSL Alias /phpMyAdmin /usr/share/phpMyAdmin Alias /phpmyadmin /usr/share/phpMyAdmin
AddDefaultCharset UTF-8 # Apache 2.4 Require ip 192.168.0.11 192.168.0.12 Require ip ::1 # Apache 2.2 Order Deny,Allow Deny from All Allow from 127.0.0.1 Allow from ::1 # Apache 2.4 Require ip 192.168.0.11 192.168.0.12 Require ip ::1 # Apache 2.2 Order Deny,Allow Deny from All Allow from 127.0.0.1 Allow from ::1# These directories do not require access over HTTP - taken from the original # phpMyAdmin upstream tarball # Order Deny,Allow Deny from All Allow from None Order Deny,Allow Deny from All Allow from None Order Deny,Allow Deny from All Allow from None # This configuration prevents mod_security at phpMyAdmin directories from # filtering SQL etc. This may break your mod_security implementation. # # # # SecRuleInheritance Off # #
4. Our last step will be restarting Apache web server.
websrv1#systemctl restart httpd
At this point if out installation was successful we should be able to access phpmyadmin http://websrv1(fqdn)/phpmyadmin