How to Install phpMyAdmin on CentOS Stream 10

phpMyAdmin

Managing MySQL or MariaDB databases from the command line can be intimidating for beginners. Thankfully, phpMyAdmin offers a simple, web-based GUI that makes database management much easier. In this article, we’ll explain what phpMyAdmin is, its key features, and guide you step-by-step on how to install and secure it on CentOS Stream 10.

Table of Contents

  1. What is phpMyAdmin?
  2. Key Features of phpMyAdmin
  3. Prerequisites
  4. Step-by-Step Installation Guide
  1. Conclusion

1. What is phpMyAdmin?

phpMyAdmin is an open-source PHP-based tool for managing MySQL and MariaDB databases through a user-friendly web interface. It allows you to run SQL queries, manage databases, tables, columns, relations, indexes, users, and much more.

2. Key Features of phpMyAdmin

  • Web-based interface with multi-language support
  • Create, edit, and delete databases/tables/columns
  • Execute SQL queries
  • Import and export data in various formats
  • Manage database users and permissions
  • Easy-to-use GUI for database backups
  • Open-source and highly customizable

3. Prerequisites

Before you begin, ensure you have:

  • A CentOS Stream 10 server
  • A sudo-enabled non-root user
  • Basic knowledge of Linux terminal
  • Internet access to download packages

4. Step-by-Step Installation Guide

4.1 Step 1: Update Your System

Run the following command to ensure your packages are up to date:

sudo dnf update -y

4.2 Step 2: Install Apache, PHP, and Extensions

Install Apache (httpd), PHP, and necessary PHP extensions:

sudo dnf install httpd php php-mysqlnd php-json php-mbstring php-xml -y

Start and enable Apache:

sudo systemctl start httpd
sudo systemctl enable httpd

4.3 Step 3: Install and Configure MariaDB

Install MariaDB server:

sudo dnf install mariadb-server -y

Start and secure MariaDB:

sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo mysql_secure_installation

Donwload And Configure PHPMyAdmin

Download the latest phpMyAdmin release:

cd /var/www/html
sudo wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz
sudo tar -xvzf phpMyAdmin-latest-all-languages.tar.gz
sudo mv phpMyAdmin-*-all-languages phpmyadmin

Set proper permissions:

sudo chown -R apache:apache /var/www/html/phpmyadmin

4.5 Step 5: Configure Apache for phpMyAdmin

Create a configuration file for phpMyAdmin:

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

Add the following:

Alias /phpmyadmin /var/www/html/phpmyadmin

<Directory /var/www/html/phpmyadmin>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

Restart Apache:

sudo systemctl restart httpd

4.6 Step 6: Secure phpMyAdmin

It’s important to restrict access to phpMyAdmin:

Option 1: Use Apache basic authentication

Install httpd-tools:

sudo dnf install httpd-tools -y

Create a password file and user:

sudo htpasswd -c /etc/phpmyadmin.pass admin

Edit /etc/httpd/conf.d/phpmyadmin.conf to include:

<Directory /var/www/html/phpmyadmin>
    AuthType Basic
    AuthName "Restricted Access"
    AuthUserFile /etc/phpmyadmin.pass
    Require valid-user
</Directory>

Restart Apache:

sudo systemctl restart httpd

4.7 Step 7: Access phpMyAdmin Web Interface

Now open your browser and visit:

http://<your-server-ip>/phpmyadmin

Login using your MariaDB username and password (e.g., root).

5. Conclusion

phpMyAdmin is a powerful and intuitive tool that simplifies database management for developers and system administrators. By following the steps above, you can easily install and secure phpMyAdmin on CentOS Stream 10.

Make sure to apply security best practices and keep your system updated regularly. phpMyAdmin, while user-friendly, should always be accessed responsibly — especially on public-facing servers.

(Visited 13 times, 2 visits today)

You may also like