introduction
The database utility,
phpMyAdmin, is used to manage MySQL databases through a web-based graphical interface. It can be configured to manage a local database (on the same system) or a remote database (over a network).
This tutorial will show you how to install phpMyAdmin and configure basic security on CentOS 7.
Introduction
- LAMP stack (Linux, Apache, MySQL, PHP) installed on the server
- user account with root privileges (ability to use the sudo command).
- The YUM update manager, which is a default component of CentOS 7
- A command prompt with root access. To open a command prompt: Menu > Applications > Utilities > Terminal.
- A text editor. Vim is included with most Linux installations or you can use Nano.
. Access to a sudo
The CentOS 7 operating system.
.
Installing phpMyAdmin on CentOS 7
Step 1: Install
EPEL Repository
(If you have already installed EPEL, you can skip this step.)
CentOS 7
does not have access to phpMyAdmin in its default software repository. You will need to access the EPEL repository: the additional packages for Enterprise Linux.
Type the following at the command prompt, then press enter
: sudo yum install -y epel-release
Once that operation is complete, it is a good idea to update and update the EPEL repository
: sudo yum -y update
Step 2: Install
Apache web server
PhpMyAdmin requires an active and running Apache web server.
To install Apache on CentOS use the command: yum install httpd -y Check the
Apache status by running with the
command: systemctl status httpd
You can also enter your server’s IP address into a browser and a test screen should appear
: Step 3: Install phpMyAdmin on CentOS 7 To install
PHPMyAdmin on CentOS,
Enter
the command: sudo yum -y install
phpmyadmin Once the system executes the command, PHPMyAdmin is installed and ready to start
.
Step 4: Configure and secure phpMyAdmin
The new software installation includes a default Apache configuration file. You’ll want to make some changes to those settings to prevent unauthorized access. Here are two common ways to restrict access to unauthorized users.
Restrict IP addresses
This method can be used to grant remote access to a single workstation. By default, phpMyAdmin is configured so that the server on which it is installed has access. This change allows you to allow or restrict access to specific IP addresses of different or additional computers.
The file is located in /etc/httpd/conf.d/phpMyAdmin.conf. Type the following at the command prompt:
sudo vim /etc/phpMyAdmin/config.inc.php
Within the configuration file, you should see four (4) lines that refer to “Require IP” or “Allow IP”. By default, they should be set to 127.0.0.1, which is the IP address that refers to the system you are working on. To allow other systems to access this phpMyAdmin application, add (or change) these numbers to the IP address of the computer you want to grant access to.
Once you have made your changes, save the file.
Change Alias Open phpMyAdmin.conf using a text editor: sudo vim /etc/phpMyAdmin/config.inc.php
Near the top, you should see two lines:
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias
/phpmyadmin /usr/share/phpMyAdmin “Alias” is how the Internet will see your
phpMyAdmin configuration.
Since the default configuration is an easy target for bots and hackers, Consider changing your alias settings. Simply place a ‘#’ sign before existing entries so that the program sees them as comments, rather than instructions. Then add your own line
: Alias /MySecretLogin /usr/share/phpMyAdmin
Now, when you go to your login screen, you will have to type https://IP_OR_DOMAIN/MySecretLogin (or whatever you choose) to get access
.
Once you have finished making changes, save the file.
Step 5: Restart
Apache Regardless of the
configuration you use, you will need
to restart the Apache service to see the changes: sudo systemctl restart httpd.service
Step 6: Check
phpMyAdmin is working
To check if phpMyAdmin is working properly, enter the IP and/phpmyadmin of your servers in a web browser. For example:
125.0.0.2/phpmyadmin
You should see the
PhpMyAdmin login screen.
Conclusion
PhpMyAdmin is a widely used application for database management. If you follow it closely, you should fine this guide on how to install PhpMyAdmin on CentOS 7 very useful.