phpMyAdmin is a web-based tool for managing MySQL and MariaDB databases. It provides an intuitive interface for performing tasks like managing databases, running queries, and handling user permissions. Installing phpMyAdmin on CentOS, Red Hat, or Fedora requires configuring the web server and PHP dependencies, as phpMyAdmin is not included in the default repositories for some of these distributions.
To install phpMyAdmin on these systems, you must enable the EPEL (Extra Packages for Enterprise Linux) repository, which provides additional software packages like phpMyAdmin. The process also involves setting up the required services, such as Apache and PHP, and securing the installation for remote access.
This guide provides step-by-step instructions for installing phpMyAdmin on CentOS, Red Hat, and Fedora.
Steps to install phpMyAdmin on CentOS, Red Hat, or Fedora:
- Enable the EPEL repository to access additional packages.
$ sudo dnf install epel-release Last metadata expiration check: 0:00:01 ago on Mon 21 Sep 2024 09:12:17 AM UTC. Dependencies resolved. ======================================================================================================== Package Architecture Version Repository Size ======================================================================================================== Installing: epel-release noarch 8-11.el8 extras 22 k Transaction Summary ======================================================================================================== Install 1 Package Total download size: 22 k Installed size: 32 k Is this ok [y/N]: y Downloading Packages: epel-release-8-11.el8.noarch.rpm 123 kB/s | 22 kB 00:00 Running transaction check Transaction test succeeded Running transaction Installing : epel-release-8-11.el8.noarch 1/1 Verifying : epel-release-8-11.el8.noarch 1/1 Installed: epel-release-8-11.el8.noarch Complete!
- Update the package list to ensure it includes the latest available versions.
$ sudo dnf update Last metadata expiration check: 0:00:01 ago on Mon 21 Sep 2024 09:12:17 AM UTC. Dependencies resolved. Nothing to do. Complete!
- Install phpMyAdmin via the dnf package manager.
$ sudo dnf install phpMyAdmin Dependencies resolved. ======================================================================================================== Package Architecture Version Repository Size ======================================================================================================== Installing: phpMyAdmin noarch 5.0.4-1.el8 epel 5.6 M php-mbstring x86_64 7.4.6-1.el8 base 488 k php-zip x86_64 7.4.6-1.el8 base 110 k Installing dependencies: php-json x86_64 7.4.6-1.el8 base 66 k Transaction Summary ======================================================================================================== Install 4 Packages Total download size: 6.2 M Installed size: 28 M Is this ok [y/N]: y Downloading Packages: (1/4): php-mbstring-7.4.6-1.el8.x86_64.rpm 129 kB/s | 488 kB 00:03 (2/4): php-zip-7.4.6-1.el8.x86_64.rpm 92 kB/s | 110 kB 00:01 (3/4): php-json-7.4.6-1.el8.x86_64.rpm 82 kB/s | 66 kB 00:00 (4/4): phpMyAdmin-5.0.4-1.el8.noarch.rpm 129 kB/s | 5.6 MB 00:44 Running transaction check Transaction test succeeded Running transaction Installing : php-json-7.4.6-1.el8.x86_64 1/4 Installing : php-mbstring-7.4.6-1.el8.x86_64 2/4 Installing : php-zip-7.4.6-1.el8.x86_64 3/4 Installing : phpMyAdmin-5.0.4-1.el8.noarch 4/4 Verifying : php-zip-7.4.6-1.el8.x86_64 1/4 Verifying : php-mbstring-7.4.6-1.el8.x86_64 2/4 Verifying : php-json-7.4.6-1.el8.x86_64 3/4 Verifying : phpMyAdmin-5.0.4-1.el8.noarch 4/4 Installed: phpMyAdmin-5.0.4-1.el8.noarch php-json-7.4.6-1.el8.x86_64 php-mbstring-7.4.6-1.el8.x86_64 php-zip-7.4.6-1.el8.x86_64 Complete!
- Install Apache and PHP if they are not already installed.
$ sudo dnf install httpd php php-mysqlnd Dependencies resolved. ======================================================================================================== Package Arch Version Repo Size ======================================================================================================== Installing: httpd x86_64 2.4.37-16.module+el8.2.0+4109+617a9a99 AppStream 1.4 M php x86_64 7.2.24-1.module+el8.2.0+339+ee0d5993 AppStream 1.5 M php-mysqlnd x86_64 7.2.24-1.module+el8.2.0+339+ee0d5993 AppStream 178 k Transaction Summary ======================================================================================================== Install 3 Packages Total download size: 3.0 M Installed size: 8.9 M Is this ok [y/N]: y Downloading Packages: (1/3): httpd-2.4.37-16.module+el8.2.0+4109+617a9a99.x86_64.rpm 123 kB/s | 1.4 MB 00:11 (2/3): php-mysqlnd-7.2.24-1.module+el8.2.0+339+ee0d5993.x86_64.rpm 88 kB/s | 178 kB 00:02 (3/3): php-7.2.24-1.module+el8.2.0+339+ee0d5993.x86_64.rpm 103 kB/s | 1.5 MB 00:14 Running transaction check Transaction test succeeded Running transaction Installing : php-mysqlnd-7.2.24-1.module+el8.2.0+339+ee0d5993.x86_64 1/3 Installing : php-7.2.24-1.module+el8.2.0+339+ee0d5993.x86_64 2/3 Installing : httpd-2.4.37-16.module+el8.2.0+4109+617a9a99.x86_64 3/3 Verifying : php-mysqlnd-7.2.24-1.module+el8.2.0+339+ee0d5993.x86_64 1/3 Verifying : php-7.2.24-1.module+el8.2.0+339+ee0d5993.x86_64 2/3 Verifying : httpd-2.4.37-16.module+el8.2.0+4109+617a9a99.x86_64 3/3 Installed: httpd-2.4.37-16.module+el8.2.0+4109+617a9a99.x86_64 php-7.2.24-1.module+el8.2.0+339+ee0d5993.x86_64 php-mysqlnd-7.2.24-1.module+el8.2.0+339+ee0d5993.x86_64 Complete!
- Start and enable Apache to run on boot.
$ sudo systemctl start httpd $ sudo systemctl enable httpd Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
- Open the phpMyAdmin configuration file for Apache.
$ sudo vi /etc/httpd/conf.d/phpMyAdmin.conf
- Uncomment the Alias line to set the URL path for accessing phpMyAdmin.
Alias /phpmyadmin "/usr/share/phpMyAdmin"
- Edit the access control rules in the same file to allow remote access.
Require all granted
- Restart the Apache web server to apply the changes.
$ sudo systemctl restart httpd
- Secure the phpMyAdmin installation by adding password protection. Create a .htpasswd file for authentication.
$ htpasswd -c /etc/phpMyAdmin/.htpasswd your_username New password: Re-type new password: Adding password for user your_username
- Edit the phpMyAdmin configuration file to require authentication for access.
<Directory "/usr/share/phpMyAdmin"> AuthType Basic AuthName "phpMyAdmin" AuthUserFile /etc/phpMyAdmin/.htpasswd Require valid-user </Directory>
- Restart Apache to apply the security changes.
$ sudo systemctl restart httpd
- Open the firewall to allow HTTP traffic if necessary.
$ sudo firewall-cmd --permanent --zone=public --add-service=http success $ sudo firewall-cmd --reload success
- Access phpMyAdmin through your browser by visiting the server’s IP or hostname.
http://server_ip_or_hostname/phpmyadmin
- Enter the MySQL or MariaDB root credentials when prompted to log into the phpMyAdmin dashboard.
This guide is tested on CentOS, Red Hat, and Fedora:
Version | Details |
---|---|
CentOS 8.x | Supported |
Red Hat 8.x | Supported |
Fedora 37 | Supported |

Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
Comment anonymously. Login not required.