AlmaLinuxRHEL Based

How To Install phpMyAdmin on AlmaLinux 9

Install phpMyAdmin on AlmaLinux 9

phpMyAdmin is a powerful and user-friendly web-based database management tool that simplifies the process of managing MySQL and MariaDB databases. It provides an intuitive interface for performing various database operations, such as creating tables, executing queries, and managing user privileges. In this comprehensive guide, we will walk you through the step-by-step process of installing phpMyAdmin on AlmaLinux 9, a stable and reliable server operating system.

AlmaLinux 9, a community-driven fork of Red Hat Enterprise Linux (RHEL), offers a robust and secure platform for hosting web applications and databases. By installing phpMyAdmin on AlmaLinux 9, you can leverage the stability and performance of the operating system while benefiting from the ease of use and functionality provided by phpMyAdmin.

Prerequisites

Before proceeding with the installation of phpMyAdmin, ensure that your AlmaLinux 9 system meets the following requirements:

  • AlmaLinux 9 installed and updated to the latest version.
  • Root or sudo user access to execute administrative commands.
  • LAMP (Linux, Apache, MySQL/MariaDB, PHP) stack properly set up and running on your server.

If you haven’t already installed the LAMP stack on your AlmaLinux 9 server, refer to the official documentation or follow a reliable guide to set it up before continuing with the phpMyAdmin installation.

Step 1: Update System Packages

To ensure that your AlmaLinux 9 system is up to date with the latest security patches and software versions, run the following command:

sudo dnf update

This command will fetch and install any available updates for the installed packages on your system.

Step 2: Enable EPEL and REMI Repositories

To install phpMyAdmin on AlmaLinux 9, you need to enable the EPEL (Extra Packages for Enterprise Linux) and REMI repositories. These repositories provide additional packages that are not included in the default AlmaLinux repositories.

First, enable the EPEL repository by running the following command:

sudo dnf install epel-release

Next, enable the REMI repository using the following command:

sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm

Once the repositories are enabled, you can proceed with the installation of phpMyAdmin.

Step 3: Install phpMyAdmin

To install phpMyAdmin on AlmaLinux 9, execute the following command:

sudo dnf --enablerepo=remi install phpMyAdmin

This command will download and install phpMyAdmin along with its dependencies from the REMI repository.

After the installation is complete, you can verify if phpMyAdmin is installed correctly by checking its version:

phpMyAdmin --version

Step 4: Configure Apache for phpMyAdmin

By default, phpMyAdmin is configured to be accessible only from the localhost. To allow access from other systems or specific IP addresses, you need to modify the Apache configuration file for phpMyAdmin.

Open the phpMyAdmin Apache configuration file using a text editor:

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

Locate the following lines in the configuration file:

Require local
Require ip 127.0.0.1
Require ip ::1

To allow access from a specific IP address or network, add a new line with the desired IP or network range. For example, to allow access from the IP address 192.168.1.100, add the following line:

Require ip 192.168.1.100

To allow access from any IP address, you can replace the existing lines with:

Require all granted

Save the changes and exit the text editor.

Next, create a symbolic link from the phpMyAdmin directory to the Apache web server’s document root:

sudo ln -s /usr/share/phpMyAdmin /var/www/html/phpMyAdmin

Step 5: Restart Apache Web Server

For the changes to take effect, restart the Apache web server using the following command:

sudo systemctl restart httpd

Step 6: Secure phpMyAdmin

To enhance the security of your phpMyAdmin installation, it is recommended to implement some basic security measures.

Basic Authentication

One way to secure access to phpMyAdmin is by setting up basic authentication in Apache. This requires users to provide a username and password to access the phpMyAdmin login page.

To set up basic authentication, create a password file using the htpasswd utility:

sudo htpasswd -c /etc/httpd/conf.d/phpMyAdmin.htpasswd admin

Replace “admin” with your desired username. You will be prompted to enter and confirm a password for the user.

Next, edit the phpMyAdmin Apache configuration file:

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

Add the following lines to enable basic authentication:

AuthType Basic
AuthName "phpMyAdmin"
AuthUserFile /etc/httpd/conf.d/phpMyAdmin.htpasswd
Require valid-user

Save the changes and restart Apache:

sudo systemctl restart httpd

SSL/TLS Encryption

To encrypt the communication between the web browser and the server, it is recommended to configure SSL/TLS for phpMyAdmin. You can obtain a free SSL/TLS certificate from Let’s Encrypt and configure Apache to use it.

Install the Certbot client and Apache plugin:

sudo dnf install certbot python3-certbot-apache

Obtain and install the SSL/TLS certificate:

sudo certbot --apache -d your_domain.com

Replace “your_domain.com” with your actual domain name.

Follow the prompts to configure the SSL/TLS certificate and enable automatic renewal.

Step 7: Access phpMyAdmin

After completing the installation and configuration steps, you can access phpMyAdmin through a web browser.

Open your preferred web browser and enter the following URL:

http://your-server-ip/phpMyAdmin

Replace “your-server-ip” with the IP address or domain name of your AlmaLinux 9 server.

Install phpMyAdmin on AlmaLinux 9

You will be prompted to enter your MySQL/MariaDB username and password. Use the credentials you set up during the LAMP stack installation to log in.

Troubleshooting Common Issues

If you encounter any issues during the installation or while accessing phpMyAdmin, here are a few common problems and their solutions:

  • Access Denied Error: If you see an “Access Denied” error when trying to log in to phpMyAdmin, ensure that you are using the correct MySQL/MariaDB username and password. Double-check the credentials and make sure the user has the necessary privileges to access the databases.
  • phpMyAdmin Not Found: If you receive a “404 Not Found” error when accessing phpMyAdmin, verify that the symbolic link from the phpMyAdmin directory to the Apache document root is correctly set up. Also, ensure that the Apache web server is running and properly configured.
  • Forbidden Error: If you encounter a “403 Forbidden” error, it indicates that the Apache configuration is not allowing access to phpMyAdmin. Review the phpMyAdmin Apache configuration file and ensure that the access permissions are correctly set.

Congratulations! You have successfully installed phpMyAdmin. Thanks for using this tutorial for installing the phpMyAdmin on your AlmaLinux 9 system. For additional help or useful information, we recommend you check the official phpMyAdmin website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button