How to Install Latest PhpMyAdmin in RHEL, CentOS & Fedora

MySQL administration via command-line in Linux is very difficult job for any newbie system administrator or database administrator, because it contains numerous commands which we cannot remember in our daily life.

Suggested Read: MySQL Basic Database Administration Commands

To make MySQL administration much easier we’re introducing a web based MySQL administration tool called PhpMyAdmin, with the help of this tool you can control and manage your database administration via a web browser easily.

PhpMyAdmin is a web-based interface for managing MySQL / MariaDB databases that is used as a replacement for command-line utilities.

Suggested Read: 20 MySQL (Mysqladmin) Commands for Database Administration in Linux

It was written in PHP language, through this application you can do various MySQL administration tasks such as create, drop, alter, delete, import, export, search, query, repair, optimize and run other database management command via browser.

As other well-known web-based interfaces for managing system services, blog creation tools, or content management systems (CMSs), it is often targeted by malicious attackers who seek to exploit the usual lack of security measures.

In this article we’re going to show you how to install latest stable version of PhpMyAdmin for Apache or Nginx on RHEL, CentOS and Fedora distributions.

Here we’ve provided installation of PhpMyAdmin for both the web server’s Apache or Nginx. So, its up-to you which web server to choose for installation.

But do remember that, you must have working LAMP (Linux, Apache, PHP and MySQL/MariaDB) or LEMP (Linux, Nginx, PHP and MySQL/MariaDB) setup installed on your working system.

If you don’t have working LAMP or LEMP, you can follow our below articles to setup.

Install LAMP Stack

  1. Install LAMP Stack on RHEL/CentOS 7/6 & Fedora 28-24

Install LEMP Stack

  1. Install LEMP Stack on RHEL/CentOS 7/6 & Fedora 28-24

Step 1: Install EPEL and Remi Repositories

1. To install most recent version of PhpMyAdmin (i.e. 4.8), you need to install and enable EPEL and Remi repositories on your respective Linux distributions as shown:

On RHEL/CentOS 7

# yum install epel-release
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm 

On RHEL/CentOS 6

-------------- On RHEL/CentOS 6 - 32-bit --------------
# yum install epel-release
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

-------------- On RHEL/CentOS 6 - 64-bit --------------
# yum install epel-release
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

On Fedora 28-24

# rpm -Uvh http://rpms.famillecollet.com/fedora/remi-release-28.rpm   [On Fedora 28]
# rpm -Uvh http://rpms.famillecollet.com/fedora/remi-release-27.rpm   [On Fedora 27]
# rpm -Uvh http://rpms.famillecollet.com/fedora/remi-release-26.rpm   [On Fedora 26]
# rpm -Uvh http://rpms.famillecollet.com/fedora/remi-release-25.rpm   [On Fedora 25]
# rpm -Uvh http://rpms.famillecollet.com/fedora/remi-release-24.rpm   [On Fedora 24]

Step 2: Installing PhpMyAdmin Web Interface

2. Once you’ve installed above repositories, now its’ time to install PhpMyAdmin with the help of following command as shown.

# yum --enablerepo=remi install phpmyadmin

Note : If your are using PHP 5.4 on RHEL/CentOS/Fedora systems, then you need to run the below command to install it.

# yum --enablerepo=remi,remi-test install phpmyadmin

Step 3: Configuring PhpMyAdmin for Apache or Nginx

In Apache you don’t need to configure anything for phpMyAdmin, because you will get working phpMyAdmin automatically at the address http://<ip address>/phpmyadmin.

Suggested Read: MySQL Backup and Restore Commands for Database Administration

The main configuration file is located under /etc/httpd/conf.d/phpMyAdmin.conf, make sure the Require all granted directive (For Apache 2.4) and Allow from ip address is added inside the Directory /usr/share/phpmyadmin block.

PhpMyAdmin Allow Access

PhpMyAdmin Allow Access

Finally, restart Apache to apply changes.

-------------- On RHEL/CentOS 7 and Fedora 28-24 --------------
# systemctl restart httpd

-------------- On RHEL/CentOS 6 --------------
# service httpd restart

On the Nginx web server, we will create a symbolic link to PhpMyAdmin installation files to our Nginx web document root directory (i.e. /usr/share/nginx/html) by running the following command:

# ln -s /usr/share/phpMyAdmin /usr/share/nginx/html

Finally, restart Nginx and PHP-FPM to apply changes.

-------------- On RHEL/CentOS 7 and Fedora 28-24 --------------
# systemctl restart nginx
# systemctl restart php-fpm

-------------- On RHEL/CentOS 6 --------------
# service nginx restart
# service php-fpm restart

Step 4: Accessing PhpMyAdmin Web Interface

Open your browser and point your browser to http://<ip address>/phpmyadmin. It should open the phpmyadmin interface (as shown in the image below).

PhpMyAdmin Running on Fedora 24

PhpMyAdmin Running on Fedora 24

In the next articles, we will share some tips to secure your phpmyadmin installation on a LAMP or LEMP stack against the most common attacks carried out by malicious individuals.

Read Also: How to Secure Default PhpMyAdmin Login URL

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Ravi Saive

I am Ravi Saive, creator of TecMint. A Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux. Follow Me: Twitter, Facebook and Google+

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

54 Responses

  1. Ahmer Mansoor says:

    Good article. But can you produce the same guide for phpMyAdmin 5.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.