How to Install phpMyAdmin on AlmaLinux / CentOS 8

How to Install phpMyAdmin on AlmaLinux / CentOS 8

phpMyAdmin is an open-source, web-based administration tool written in PHP.

It is a popular tool used for managing MySQL and MariaDB servers. It is used by system administrators for performing activities such as creating and managing databases, users, relations, permissions. It has a simple and user-friendly interface for performing database administration tasks.

In this guide, we will go through the installation of phpMyAdmin on AlmaLinux


Before installing PHPMyAdmin, you need to have the following requisite packages installed.

  • PHP
  • Database Server(MySQL or MariaDB)
  • Apache Web server.

Step 1: Install additional PHP modules

The Current version of PhpMyAdmin is compatible with PHP 7.1 and later versions as well as MySQL/MariaDB 5.5 and newer versions. You need to install PHP as well as the MySQL support package for PHP, and other necessary PHP packages for phpMyAdmin to function as expected on your CentOS / AlmaLinux system.

Therefore, run the following command to install the necessary php packages required to utilize PHP with Apache and MySQL:

$ sudo dnf -y install php php-fpm php-mysqlnd php-opcache php-gd php-xml php-mbstring php-zip

Step 2: Install phpMyAdmin

Once the dependencies have been installed, our system is now ready for the phpMyAdmin installation. phpMyAdmin is not available in the system’s default repositories, and so you need to download the latest version of the phpMyAdmin archive from the official site. At the time of writing this guide, the current version of phpMyAdmin is 5.1.1

Run the following wget command to download phpMyAdmin zip file:

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

After the download is complete, extract the packages as shown:

$ unzip phpMyAdmin-5.1.1-all-languages.zip

Next, move phpMyAdmin to the usr/share/phpMyadmin directory.

$ sudo mv phpMyAdmin-5.1.1-all-languages /usr/share/phpMyAdmin

Then, create a tmp directory . Run:

$ sudo mkdir -p /usr/share/phpMyAdmin/tmp

Set the necessary permissions with the commands:

$ sudo chown -R apache:apache /usr/share/phpMyAdmin
$ sudo chmod 777 /usr/share/phpMyAdmin/tmp

Step 3: Configure Apache web server for phpMyAdmin

In this step, we will configure the web server to serve phpMyAdmin on the network. First, let’s create an Apache configuration file for phpMyAdmin.

$ sudo vi /etc/httpd/conf.d/phpmyadmin.conf

Paste the lines below to the apache configuration file. Here, we also create an alias that we will use to access phpMyAdmin.

Alias /phpmyadmin /usr/share/phpMyAdmin


<Directory /usr/share/phpMyAdmin/>

 AddDefaultCharset UTF-8

 <IfModule mod_authz_core.c>

 # Apache 2.4


 Require all granted




<Directory /usr/share/phpMyAdmin/setup/>

 <IfModule mod_authz_core.c>

# Apache 2.4


 Require all granted




Save and close the file.

Step 4: Configure SELinux and Firewall

For systems with SELinux enabled, run the following command to set correct permissions to allow SELinux policies.

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

Finally, ensure to restart the Apache service for all the changes to take effect. Run:

$ sudo systemctl restart httpd

If you have enabled the firewall, you need to allow HTTP traffic. Run the following command to allow HTTP traffic:

$ sudo firewall-cmd --permanent --add-service=http

Next, reload the firewall after making these changes

$ sudo firewall-cmd --reload

Great! The only thing remaining is to access phpMyAdmin from a browser.

Access phpMyAdmin

Finally, let’s access the phpMyAdmin web portal. Open your web browser and access PHP my admin with the following address:

$ http://your-server-ip/phpMyAdmin

The browser will now display the phpMyAdmin login page.

Login with your MariaDB root credentials:

systemctl restart httpd.service

You will be directed to the phpMyAdmin dashboard as provided.

From here, you can create and manage all the databases conveniently without the need of running SQL queries.


You have successfully completed the installation and configuration of phpMyAdmin on CentOS 8/AlmaLinux 8.

Similar Posts