Premise
Installing phpMyAdmin on CentOS, you first need to set up a Web server (such as Apache or Nginx) to install the MYSQL/MARIADB database and PHP. Depending on your preferences and needs, you can choose an installation from lamp and lemp.
Another requirement is to allow the Epel library to be installed on your centos. If you haven't set it up, poke it in here.
install phpMyAdmin on CentOS6 or 7
Once you have set up the Epel library, you can easily install phpMyAdmin with the following commands.
On the CentOS 7:
$ sudo yum install phpMyAdmin
On the CentOS 7:
$ sudo yum install phpMyAdmin php-mcrypt
Configure phpMyAdmin on CentOS 7
By default, phpMyAdmin on CentOS 7 only allows access from a loopback address (127.0.0.1). In order to connect remotely, you need to change its configuration.
Open the phpMyAdmin configuration file (path:/etc/httpd/conf.d/phpmyadmin.conf) with a text editor, and locate and comment out the line of code with the words "Require IP XXXX". There will be lines of code everywhere, replaced with "Require all granted". The changed configuration file is shown below.
$ sudo vi/etc/httpd/conf.d/phpmyadmin.conf ... <Directory/usr/share/phpMyAdmin/> adddefaultchar
Set UTF-8 <ifmodule mod_authz_core.c> # Apache 2.4 <RequireAny> #Require IP 127.0.0.1 #Require IP:: 1 Require all granted </RequireAny> </IfModule> <ifmodule!mod_authz _core.c> # Apache 2.2 order Deny,allow Deny to all Allow from 127.0.0.1 Allow:: 1 & lt;/ifmodule> </Directory> <Directory/usr/share/phpMyAdmin/setup/> <ifmodule mod_authz_core .c> # Apache 2.4 <RequireAny> #Require ip 127.0.0.1 #Require IP:: 1 Require all Grant Ed </RequireAny> </IfModule> <ifmodule!mod_authz_core.c> # Apache 2.2 Order Deny , Allow Deny from all Allow to 127.0.0.1 Allow from:: 1 </IfModule> </Directory>.
. . . .
Finally, restart the httpd to make the changes take effect.
$ sudo systemctl restart httpd
Configure phpMyAdmin on CentOS 6
By default, the phpMyAdmin on CentOS 6 is prohibited from being accessed from each IP address. In order to connect remotely, you need to change its configuration.
Open the phpMyAdmin configuration file (path:/etc/httpd/conf.d/phpmyadmin.conf) with a text editor, and locate and annotate the line of code for the words "Deny from". Then change the line of code for the word "Allow from 127.0.0.1" to "Allow from 0.0.0.0". The changed configuration file is shown below.
$ sudo vi/etc/httpd/conf.d/phpmyadmin.conf
<directory "/usr/share/phpmyadmin" > Order
deny,allow
# Deny from all
Allow 0.0.0.0
</Directory>
The next step is to encrypt the phpMyAdmin configuration file with the Blowfish encryption tool. This step requires encrypting the password in the cookie as part of the authentication based on cookies.
Open the file shown in the following path with a text editor and set a random password with Blowfish, as shown below.
$ sudo vi/usr/share/phpmyadmin/config.inc.php
$cfg [' blowfish_secret '] = ' kd5g}d33axdc50! '; /* You must the FILL in the for COOKIE auth! */
Finally, restart the httpd to make the changes take effect.
$ sudo service httpd restart
Test phpMyAdmin
Test whether phpMyAdmin is set up successfully, Access this page: Http://<web-server-ip-addresss>/phpmyadmin