install phpMyAdmin On CentOS 8

Step 1 : Visit phpMyAdmin page and check the latest available package Save version to variable.

export PHPMYADMIN_VER="4.9.1"

Step 2 : we install the phpmyadmin package:

curl -o phpMyAdmin-${PHPMYADMIN_VER}-all-languages.tar.gz${PHPMYADMIN_VER}/phpMyAdmin-${PHPMYADMIN_VER}-all-languages.tar.gz

Step 3 : Extract

tar -xvf phpMyAdmin-${PHPMYADMIN_VER}-all-languages.tar.gz
rm phpMyAdmin-*.tar.gz

Step 4 : Move the folder to /usr/share/phpmyadmin.

sudo mv phpMyAdmin-${PHPMYADMIN_VER}-all-languages /usr/share/phpmyadmin

Step 5 : Create a tmp directory for phpMyAdmin.

sudo mkdir -p /var/lib/phpmyadmin/tmp
sudo chown -R apache:apache /var/lib/phpmyadmin

Step 6 : Create phpMyAdmin configuration

sudo cp /usr/share/phpmyadmin/  /usr/share/phpmyadmin/

Edit phpMyAdmin configuration file

sudo nano /usr/share/phpmyadmin/

Set a blowfish secret (Needs to be 32 chars long) Generate blowfish secret : And Configure Temp directory

$cfg['blowfish_secret'] = '4JfdM2zMDT6Nnmpm5ykH5vp6Z6qnR8ep';
$cfg['TempDir'] = '/var/lib/phpmyadmin/tmp';

Step 7 : Create an alias in the Apache web server

sudo nano /etc/httpd/conf.d/phpMyAdmin.conf

Copy and paste the below code.

# Apache configuration for phpMyAdmin
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
     Require all granted
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from
     Allow from ::1

Step 8 : Test Apache configuration and Restart httpd service.

sudo apachectl configtest
sudo systemctl restart httpd

Step 9 : SELinux

Create SELinux policies

sudo yum install -y policycoreutils-python-utils
sudo semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/phpmyadmin/'
sudo restorecon -Rv '/usr/share/phpmyadmin/'

Step 10 : Open the URL http://ServerIP/phpmyadmin

Login to phpMyAdmin dashboard

Step 11 : Setup the phpMyAdmin configuration storage

Click on create


Add Comment