How to Install phpMyAdmin on Rocky Linux 8

In this guide, we will demonstrate how to install phpmyadmin on a Rocky Linux 8 powered system.

Prerequisites:

phpMyadmin requires LAMP stack installed and running

For detailed installation, refer to LAMP Stack on Rocky Linux 8

Install the required packages.

dnf install php php-pdo php-pecl-zip php-json php-mbstring php-mysqlnd

Enable and start httpd web server.

systemctl enable httpd.service

systemctl start httpd.service

Installing phpMyAdmin

Download the latest phpMyAdmin archive from the official download page.

wget https://files.phpmyadmin.net/phpMyAdmin/5.0.1/phpMyAdmin-5.0.1-all-languages.zip

Extract archive file.

unzip phpMyAdmin-5.0.1-all-languages.zip

Move the file to /usr/share/phpmyadmin.

mv phpMyAdmin-5.0.1-all-languages /usr/share/phpmyadmin

create tmp directory and set permissions.

mkdir /usr/share/phpmyadmin/tmp

chown -R apache:apache /usr/share/phpmyadmin

chmod 777 /usr/share/phpmyadmin/tmp

Configure phpMyAdmin

Edit the phpMyAdmin.conf file.

nano /etc/httpd/conf.d/phpmyadmin.conf

And add the content to the file.

Alias /phpmyadmin /usr/share/phpmyadmin

<Directory /usr/share/phpmyadmin/>
   AddDefaultCharset UTF-8
   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
      Require all granted
     </RequireAny>
   </IfModule>
</Directory>

<Directory /usr/share/phpmyadmin/setup/>
   <IfModule mod_authz_core.c>
 # Apache 2.4
     <RequireAny>
       Require all granted
     </RequireAny>
   </IfModule>
</Directory>

Enable SELinux and set permissions.

chcon -Rv --type=httpd_sys_content_t /usr/share/phpmyadmin/*

Restart the apache service reload all settings.

systemctl restart httpd.service

To make your pages available to public, you will have to edit your firewall rules to allow HTTP and HTTPS requests on your web server by using the following commands.

firewall-cmd --permanent --zone=public --add-service=http 

firewall-cmd --permanent --zone=public --add-service=https 

firewall-cmd --reload

Accessing phpMyAdmin

Navigate to your browser and enter the IP Address of the server in the browser's address bar,

http://IP-Address/phpmyadmin/

image