How To Install phpMyAdmin on a Fresh CentOS 7 Server

Installing phpMyAdmin & Configuring It

In the previous article, we’ve learned how to install LAMP Stack on a fresh CentOS 7 server. In this one, we’re going to learn how to install phpMyAdmin and configure it on a fresh CentOS 7 VPS. Before we begin, first let’s see what phpMyAdmin is.

What is phpMyAdmin?

According to Wikipedia,

phpMyAdmin is a free and open-source administration tool for MySQL and MariaDB. As a portable web application written primarily in PHP, it has become one of the most popular MySQL administration tools, especially for web hosting services.

So as mentioned above, it’s a database management interface which makes it easier for a developer to execute queries in a web-based GUI(Graphical User Interface). So before we begin, let’s take a look at how phpMyAdmin looks like.

Credit:- DigitalOcean

How To Install phpMyAdmin on CentOS 7 server?

Starting on with step number one.

Step 1 – Updating Packages

Let’s update it via Yum package manager before we begin installing any type of packages.

sudo yum update -y

So with the above command, we’ve updated all packages currently existing in the server. Where “-y” means automatically confirming all types of prompts that are going to be asked during installation. This can be done when installing packages too.

Step 2 – Installing Apache(httpd)

Now we’re going to install Apache. If you’ve already installed it, skip this step. But if you haven’t type the command mentioned below to begin installing Apache on your CentOS server.

sudo yum install httpd -y

With this command, we’ve successfully installed Apache. Where “-y” again means automatically confirming all prompts that are going to be asked while package installation process.

Testing if Apache works correctly.

In order to test if Apache works correctly, we’ve to visit the webpage. To do so, copy your server’s IP or hostname and paste it in your web browser. If you see something like this, it means you’ve successfully installed Apache on your server.

HTTPD Test Page - LAMP Stack

Step 3 – Installing EPEL Repository

phpMyAdmin doesn’t come with default Yum packages. To bring it inside Yum package manager, we need to install a special package ie EPEL Repository(Extra Packages for Enterprise Linux). To install the EPEL Repository(epel-release), type the following command in your SSH client, and press Enter.

sudo yum install epel-release -y

With the above command, you’ve successfully installed the EPEL Repository. It’s now time to install phpMyAdmin which is in the next step.

Step 4 – Installing phpMyAdmin

It’s now the time come after installing pretty much a lot of stuff. It’s time to install phpMyAdmin. We will also install other necessary packages which we’re going to require ahead in configuring the phpMyAdmin. I will include “nano” text editor in it.

sudo yum install phpmyadmin nano -y

Now we’ve successfully installed phpMyAdmin and “nano” text editor.

Step 5 – Configuring phpMyAdmin – Fixing 403 Forbidden Error

By default, phpMyAdmin is only accessible for localhost users. We will configure it so that it can be accessible to your IP and every time if your IP changes, it will be accessible. To configure, we will use “nano” text editor. Type the following command to edit the phpMyAdmin configuration file.

nano /etc/httpd/conf.d/phpMyAdmin.conf

Find the below-shown file in the file by navigating it to the downside by pressing down arrow button.

phpMyAdmin Configuration

In the above screenshot, you can see multiple lines of code. Replace this code

Require ip 127.0.0.1
Require ip ::1

With the below-mentioned code. Technically adding “Require all granted” which means allowing all IPs to access the phpMyAdmin webpage.

Require ip 127.0.0.1
Require ip ::1
Require all granted

Now press “CTRL + X” and then press the Enter button to save the file.

Step 6 – Restarting Apache

Now as we’ve successfully configured phpMyAdmin, it’s time to restart Apache webserver. To do that, type the following command and press Enter.

service httpd restart

It’s time to test if your phpMyAdmin really works. To do so, copy your server’s hostname or IP address and paste it into a web browser with “/phpmyadmin” at the end. For example, http://1.2.3.4/phpmyadmin. You will see the phpMyAdmin page opening properly.

Done!

You’ve successfully installed phpMyAdmin on your CentOS 7 machine. It’s time to rock and roll by accessing it by using the MySQL credentials in it. As you have set up root MySQL password, use “root” as username and password as you’ve set while installing LAMP Stack.

Common Troubleshooting

The most common error you might face after installing phpMyAdmin is it is still showing the error. To fix this, try the below-mentioned options to see if it works.

Forgot to restart Apache

Most of those who are installing for the first time are excited to see if it works after configuring which leaves them still having the error. So don’t be too much excited and restart the Apache wisely and it may start working.

Firewall Issue

phpMyAdmin might not be able to be logged in or even the whole Apache is inaccessible even after installing it. This can happen if port 3306(SQL Server port) or port 80(Web server port) or both are blocked. You might want to unblock it by contacting your provider or using iptables to unblock the ports.


Conclusion

Thank you for reading out the article. Your thoughts are very much appreciated in the comment section below!

VPS You Might Want To Try On Installing phpMyAdmin

If you’re searching for a VPS provider, you surely would’ve been looking for a reliable one who can help you if you’re stuck in any step or error of above-mentioned step. At Shadow Hosting, we would help you get your issue fixed so that your operations can run smoothly. Despite being an unmanaged service, we would surely be grateful to assist you in anything possible in our scope. The best thing is, our highly responsive and great support comes for FREE with any VPS Hosting or any other package with us. Order now and enjoy your journey discovering new stuff if you’re new in Linux computing or migrate your data with your poor-performing provider to our service.

About Manal Shaikh 21 Articles
Manal Shaikh, the Founder of Shadow Networks International and CEO/Chairman of Shadow Hosting International. A cybersecurity analyst, network analyst and a web administrator.

1 Trackback / Pingback

  1. How To Increase Import Size Limit of phpMyAdmin on a CentOS 7 Server

Leave a Reply

Your email address will not be published.


*


CommentLuv badge