phpMyAdmin is a popular web-based tool used for managing MySQL and MariaDB databases. It provides an intuitive and easy-to-use interface that makes database management tasks simple and efficient. In this tutorial, we will guide you through the process of how to install phpMyAdmin on your Rocky Linux system.
Prerequisites
Before we begin, ensure that you have the following:
- A Rocky Linux system with a LAMP stack installed. If you haven’t installed it yet, follow our guide on how to install and configure LAMP stack on Rocky Linux.
- A user with
sudo
privileges.
How to Install phpMyAdmin on Rocky Linux
Install EPEL Repository
phpMyAdmin is not available in the default Rocky Linux repositories, so we need to install the Extra Packages for Enterprise Linux (EPEL) repository first:
sudo dnf install epel-release -y
Install phpMyAdmin
With the EPEL repository enabled, you can now install phpMyAdmin:
sudo dnf install phpmyadmin -y
Configure phpMyAdmin
To access phpMyAdmin securely, we need to make a few changes to its configuration file:
- Open the configuration file:
sudo vim /etc/httpd/conf.d/phpMyAdmin.conf
- Find the following lines:
<RequireAny>
Require ip 127.0.0.1
Require ip ::1
</RequireAny>
- Replace the IP addresses with your system’s IP address or a range of IP addresses that should be allowed to access phpMyAdmin. For example:
<RequireAny>
Require ip 192.168.1.0/24
Require ip ::1
</RequireAny>
- Save the changes and exit the editor.
- Restart the Apache web server for the changes to take effect:
sudo systemctl restart httpd
Secure phpMyAdmin with a Password
To further enhance security, let’s create a password-protected directory for phpMyAdmin:
- Install the
httpd-tools
package:
sudo dnf install httpd-tools -y
- Create a password file for the user you want to grant access to phpMyAdmin (replace
{username}
with your desired username):
sudo htpasswd -c /etc/httpd/.htpasswd {username}
- Enter the password for the user when prompted.
- Update the phpMyAdmin configuration file to include the password file:
sudo vim /etc/httpd/conf.d/phpMyAdmin.conf
- Add the following lines inside the
<Directory /usr/share/phpMyAdmin>
section:
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/httpd/.htpasswd
Require valid-user
- Save the changes and exit the editor.
- Restart the Apache web server:
sudo systemctl restart httpd
Access phpMyAdmin
Now you can access phpMyAdmin in your web browser by navigating to http://{your-server-ip}/phpMyAdmin
. Enter the username and password you created earlier, and you’ll be logged in to phpMyAdmin.
That’s it! You’ve successfully installed and secured phpMyAdmin on your Rocky Linux system. You can now manage your databases with ease. For more tutorials and guides on Rocky Linux, feel free to explore the following articles:
- How to install Git on Rocky Linux
- How to change SSH port on Rocky Linux
- How to install Vim on Rocky Linux
- How to install Ruby on Rocky Linux
- How to set up an OpenVPN server on Rocky Linux
Remember that securing your server is essential to protect your data and ensure smooth operation. We hope this tutorial has helped you in setting up phpMyAdmin on Rocky Linux, and we encourage you to explore more about this powerful and versatile operating system. If you have any questions or need further assistance, don’t hesitate to reach out to the community or consult the official documentation for more information.