How to Install phpMyAdmin on Rocky Linux 8

phpMyAdmin is a web app for administering MySQL or MariaDB. With phpMyadmin, you can perform various database management tasks, and execute SQL queries from a graphical interface via a web browser. It is free, open-source, and written in the PHP language.

In this tutorial, you will learn how to install phpMyAdmin on Rocky Linux 8 with the LAMP stack.

Prerequisites

  • LAMP stack
  • A user with sudo privileges

1. Download phpMyAdmin on Rock Linux 8

As of this writing, Rocky Linux does not have phpMyAdmin in the default package repository. But we can download phpMyAdmin from the official phpMyAdmin website. Also, phpMyAdmin 5.1.1 is the latest version available.

Run the command below to download phpMyAdmin 5.1.1.

$ curl https://files.phpmyadmin.net/phpMyAdmin/5.1.1/phpMyAdmin-5.1.1-all-languages.tar.gz --output phpmyadmin.tar.gz

Next, extract the downloaded phpMyAdmin archive to the website root -- for example, /var/www/html.

$ sudo tar -zxvf ./phpmyadmin.tar.gz -C /var/www/html

Change into the directory where phpMyAdmin was extracted to.

$ cd /var/www/html

For simplicity, let us rename the extracted phpMyAdmin folder as follows.

$ sudo mv phpMyAdmin-5.1.1-all-languages phpmyadmin

Now, change into the renamed phpmyadmin directory:

$ cd phpmyadmin

2. Configure phpMyAdmin  

First, run the command below to install the JSON, XML and MySQLi PHP modules.

$ sudo yum install php-json php-xml php-mysqli -y

After that, run the following command to create the phpMyAdmin configuration file.

$ sudo cp config.sample.inc.php  config.inc.php

Edit the phpMyAdmin configuration file:

$ sudo nano config.inc.php

In the blowfish_secret configuration parameter, choose your desired password. This should be at least 32 characters long, and you can use a combination of letters, numbers, and symbols.

Set phpMyAdmin Blowfish Secret
Set phpMyAdmin Blowfish Secret

3. Configure Apache for phpMyAdmin

Run the command below to create an Apache configuration file for phpMyAdmin. 

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

Copy the configuration below and paste it in the phpmyadmin.conf file.

<Directory /var/www/html>
    AllowOverride None
    Require all granted
</Directory>

Alias /phpMyAdmin /var/www/html/phpmyadmin/
Alias /phpmyadmin /var/www/html/phpmyadmin/

Save your changes and close the phpmyadmin.conf file.

Restart the Apache webserver:

$ sudo systemctl restart httpd

4. Test phpMyAdmin

Open a web browser and go to serverIP/phpmyadmin -- for example 192.168.192.100/phpmyadmin

You should now see the phpMyAdmin login page as shown in the image below.

Login to phpMyAdmin
Login to phpMyAdmin

You may proceed to login with your MySQL or MariaDB credentials.

phpMyAdmin Dashboard

Conclusion

In this tutorial, we showed you how to install phpMyAdmin on Rocky Linux 8 with the LAMP stack. To learn about securing your phpMyAdmin installation, please see Securing your phpMyAdmin installation. Share your comments with us below.

Leave a Comment