In my previous blog post, I showed you how-to install LAMP (Linux, Apache, MariaDB and PHP) on CentOS 7 and in this tutorial I’m going to show you how-to install phpMyAdmin on CentOS 7.If you don’t know what phpMyAdmin is; phpMyAdmin is free software written in PHP, intended to handle the administration of MySQL over the Internet.

Add Fedora EPEL Repositories

Since phpMyAdmin is not included in the CentOS default repositories, we need to get it from the Fedora Projects EPEL (Extra Packages for Enterprise Linux) repositories.

Let’s start by updating existing packages:

sudo yum -y update

Install EPEL:

sudo yum install epel-release

or

wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

You can always find the latest version of Fedora’s public mirror list here.

If wget was not a found command, install it:

sudo yum install wget

Next, we will download package:

sudo rpm -ivh epel-release*

If you want to check to see if EPEL has been added, type and enter:

yum repolist

You should see EPEL listed; something like:

epel/x86_64           Extra Packages for Enterprise Linux 7 - x86_64

We can now remove the repository package, since it’s been added to the server:

rm epel-release*

Install phpMyAdmin

We can now install phpMyAdmin:

sudo yum install phpmyadmin

Configure and Secure phpMyAdmin

We will now secure phpMyAdmin so only your personal computer’s IP address is recognized and can use phpMyAdmin.

To find your IP address, go to Google and ask Google “what is my IP”. Google search will show you, your IP address.

You can also use whatismyip.com, which is a free service.

Once you’ve figured out what your IP address is, run:

cd /etc/httpd/conf.d/

Now, we will change all occurrences of 127.0.0.1 with your IP address.

sed -i 's/127.0.0.1/newip/g' phpMyAdmin.conf

Replace newip with your personal computer’s IP address.

You can do this manually, by opening phpMyAdmin.conf and changing 127.0.0.1 to your IP address. Look for occurrences of:

Require ip 127.0.0.1

and

Allow from 127.0.0.1

You can now restart Apache like sudo systemctl restart httpd.service or start it if it hasn’t been started sudo systemctl start httpd.service.

Access phpMyAdmin

You can access phpMyAdmin by going to http://<IP Address>/phpmyadmin or http://hostname/phpmyadmin.

Where <IP Address> is your server’s IP address or where hostname is your server’s hostname.

The username is root and the password is your MariaDB / MySQL’s password.