Install the latest phpMyAdmin on CentOS 8

In the previous guide, we learned how to install WordPress 5 with MySQL 8 on CentOS 8. How to manage MySQL database directly from the web? phpMyAdmin is what you need. Follow this guide to learn how to install the latest phpMyAdmin on CentOS 8.

Install the latest phpMyAdmin on CentOS 8

prerequisites

note : In this guide, we are going to install phpMyAdmin v4.9.2, As of this writing, it is the current stable release. This version supports PHP 5.5 to 7.3 and MySQL 5.5 and higher . Keep this in mind when installing the LAMP / LEMP stack. You can check for more requirements, including required PHP modules On the PHP requirements page .

Update system packages.

                      dnf update
                    

Install LEMP / LAMP Stack on CentOS 8 via the following link;

Install LAMP Stack on CentOS 8

Install LEMP Stack on CentOS 8

In this guide, PHP 7.2, MySQL 8 with Nginx used.

Install the required PHP modules

If not already installed, run the following command to install other required PHP extensions for phpMyAdmin.

                      dnf install php-{spl,hash,ctype,json,mbstring,zip,gd,curl,xml,common}
                    

Install phpMyAdmin on CentOS 8

After setting up the LAMP / LEMP stack, database, WordPress or any web application, go ahead and install phpMyAdmin.

At the time of writing, phpMyAdmin is not available on the default CentOS 8 repository.

                      dnf whatprovides phpmyadmin
                    
                      Error: No Matches found
                    

Download phpMyAdmin

Therefore, we will install phpMyAdmin by downloading the source tarball from: phpMyAdmin download page .

You can download the phpMyAdmin suite in English or all languages. This guide uses only the English version of phpMyAdmin. Use the wget command to make downloading easy.

To download the latest stable version, check the version on the download page, then simply create a variable to hold the latest version number.

                      VER=4.9.2
                    
                      wget https://files.phpmyadmin.net/phpMyAdmin/
                      
                        $VER
                      
                      /phpMyAdmin-
                      
                        $VER
                      
                      -english.tar.gz
                    

Well, you can also download phpMyAdmin that supports all languages, so that you can run the phpMyAdmin version in your favorite language;

                      https://files.phpmyadmin.net/phpMyAdmin/
                      
                        $VER
                      
                      /phpMyAdmin-
                      
                        $VER
                      
                      -all-languages.tar.gz
                    

Verify phpMyAdmin Tarball

To ensure that you are installing the genuine version of phpMyAdmin, you need to verify the integrity of the downloaded archive.

Download and import the phpMyAdmin PGP fingerprint key from the key server.

                      gpg --keyserver hkp://pgp.mit.edu --recv-keys 3D06A59ECE730EB71B511C17CE752F178259BD92
                    

Download PGP signature from specific version of phpMyAdmin phpMyAdmin download page . For example, download the PGP signature (English version) of phpMyAdmin v4.9.2;

                      wget https://files.phpmyadmin.net/phpMyAdmin/$VER/phpMyAdmin-$VER-english.tar.gz.asc
                    

Run signature verification.

                      gpg --verify phpMyAdmin-$VER-english.tar.gz.asc
                    

Keywords in the output; Good signature .

                      
                        gpg: assuming signed data in 'phpMyAdmin-4.9.2-english.tar.gz'
gpg: Signature made Fri 22 Nov 2019 03:05:59 AM EST
gpg:                using RSA key 3D06A59ECE730EB71B511C17CE752F178259BD92
gpg: Good signature from "Isaac Bennetch <[email protected]>" [unknown]
gpg:                 aka "Isaac Bennetch <[email protected]>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 3D06 A59E CE73 0EB7 1B51  1C17 CE75 2F17 8259 BD92
                      
                    

You can also verify the checksum of the downloaded file. Download SHA256 hash for phpMyAdmin-4.9.2-english.tar.gz .

                      wget https://files.phpmyadmin.net/phpMyAdmin/
                      
                        $VER
                      
                      /phpMyAdmin-$VER-english.tar.gz.sha256
                    

Calculate the SHA256 hash of the downloaded file.

                      sha256sum phpMyAdmin-$VER-english.tar.gz
                    
                      b1a4edca4e5229fe84a221f4aaa4e98a83bace5776ab3a3127395d8a989dfd3c  phpMyAdmin-4.9.2-english.tar.gz
                    

Compare the calculated hash value with the downloaded hash value.

                      cat phpMyAdmin-$VER-english.tar.gz.sha256
                    
                      b1a4edca4e5229fe84a221f4aaa4e98a83bace5776ab3a3127395d8a989dfd3c  phpMyAdmin-4.9.2-english.tar.gz
                    

If all goes well, it would be nice to continue.

Install phpMyAdmin

Since phpMyAdmin is provided as a standalone application ready to be installed, you only need to extract it to the web root directory. In this guide, we use Nginx as a web server.

Extract phpMyAdmin Tarball

Create your phpMyAdmin Web root directory. You can choose to use a different directory than the one created below.

                      mkdir /usr/share/nginx/phpmyadmin
                    

Next, extract phpMyAdmin into the directory created above.

                      tar xzf phpMyAdmin-$VER-english.tar.gz -C /usr/share/nginx/phpmyadmin --strip-components=1
                    

Create phpMyAdmin Nginx server block

You can now create a basic Nginx Server block for phpMyAdmin as shown below. Be sure to replace the directories accordingly.

                      vi /etc/nginx/conf.d/phpmyadmin.conf
                    
                      
                        server {
    listen       80;
    server_name  pma.kifarunix-demo.com;
    root         /usr/share/nginx/phpmyadmin;
    
    access_log /var/log/nginx/pma.kifarunix-demo.com_access.log;
    error_log /var/log/nginx/pma.kifarunix-demo.com_error.log;

    index   index.php;

    location / {
        try_files    $uri $uri/ /index.php?$args;
    }
    location ~ .php$ {
         try_files $uri =404;
         fastcgi_intercept_errors on;
         include        fastcgi_params;
         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
         fastcgi_pass unix:/run/php-fpm/www.sock;
     }
}
                      
                    

Save the configuration file and run Nginx syntax verification.

                      nginx -t
                    
                      nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
                    

Restart Nginx

                      systemctl restart nginx
                    

Configure phpMyAdmin

Rename the example phpMyAdmin configuration file;

                      cp /usr/share/nginx/phpmyadmin/config{.sample,}.inc.php
                    

Create the puffer secret required for cookie-based authentication to encrypt the password in the cookie. You can generate Blowfish’s Secret Online And paste it as follows;

                      vi /usr/share/nginx/phpmyadmin/config.inc.php
                    
                      /** $cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

                      
                        $cfg['blowfish_secret'] = '{yqiCcF/-1G8WE9LE,dD{3mQDBnv[]bN';
                      
                    

Restart Nginx and PHP-FPM for the changes to take effect.

                      systemctl restart nginx php-fpm
                    

Access phpMyAdmin

You can now access phpMyAdmin from your browser by navigating to the browser and using that address, https://server-host-name .

Log in as the database root user. After successful authentication, you will be taken to the phpMyAdmin dashboard.

Install the latest phpMyAdmin on CentOS 8

You go you have successfully set up phpMyAdmin. This marks the end of our guide on how to install the latest phpMyAdmin on CentOS 8.

read more phpMyAdmin User Guide .

Related Posts