How To Install phpMyAdmin on AlmaLinux 10
Managing MySQL and MariaDB databases through command-line interfaces can be challenging for many system administrators and developers. phpMyAdmin provides an intuitive web-based solution that simplifies database administration tasks significantly. This comprehensive guide walks you through installing and configuring phpMyAdmin on AlmaLinux 10, ensuring optimal security and performance.
AlmaLinux 10 offers enterprise-grade stability and security features that make it an excellent choice for hosting web applications and database management tools. By combining AlmaLinux’s robust foundation with phpMyAdmin’s user-friendly interface, you create a powerful database management environment suitable for both development and production scenarios.
This tutorial covers everything from initial system preparation to advanced security configurations. You’ll learn multiple installation methods, troubleshooting techniques, and best practices that ensure your phpMyAdmin installation remains secure and efficient. Whether you’re a seasoned Linux administrator or new to database management, this guide provides the detailed instructions needed for successful implementation.
Understanding phpMyAdmin and AlmaLinux 10
What is phpMyAdmin?
phpMyAdmin stands as the most popular web-based administration tool for MySQL and MariaDB databases worldwide. This PHP-based application provides a comprehensive graphical user interface that eliminates the need for complex SQL commands in routine database operations. Users can create, modify, and delete databases, tables, columns, and indexes through an intuitive web interface.
The tool supports advanced features including user management, privilege assignment, database import/export operations, and SQL query execution. Its multilingual interface accommodates users globally, while the responsive design ensures compatibility across various devices and screen sizes. phpMyAdmin’s extensible architecture allows for custom plugins and themes, making it adaptable to specific organizational requirements.
AlmaLinux 10 Overview
AlmaLinux 10 represents the latest iteration of this community-driven, enterprise-grade Linux distribution. Built as a 1:1 binary compatible replacement for Red Hat Enterprise Linux, AlmaLinux provides the stability and security features required for mission-critical applications. The distribution maintains long-term support cycles, ensuring consistent updates and security patches over extended periods.
The operating system incorporates modern container technologies, enhanced security frameworks, and optimized package management through the DNF package manager. AlmaLinux 10’s commitment to open-source principles and community governance makes it an ideal choice for organizations seeking reliable, cost-effective server solutions without vendor lock-in concerns.
Prerequisites and System Requirements
Hardware Requirements
Your AlmaLinux 10 system should meet minimum hardware specifications to ensure optimal phpMyAdmin performance. Allocate at least 2GB of RAM for basic operations, though 4GB or more is recommended for handling larger databases and concurrent user sessions. CPU requirements remain modest, with any modern dual-core processor providing adequate performance for typical workloads.
Storage considerations depend heavily on database sizes and backup requirements. Reserve minimum 20GB of free disk space for the operating system, web server components, and phpMyAdmin installation. Plan additional storage capacity based on expected database growth and backup retention policies.
Software Prerequisites
Ensure your AlmaLinux 10 installation is complete and updated before proceeding with phpMyAdmin installation. Root access or sudo privileges are essential for installing packages, modifying configuration files, and managing system services. Verify network connectivity and ensure the system can reach external repositories for package downloads.
Domain name resolution should function correctly, and any corporate firewalls must allow access to standard repository URLs. Consider configuring a static IP address if the server will be accessed remotely, as dynamic addressing can complicate ongoing access and maintenance procedures.
LAMP Stack Components
phpMyAdmin requires a complete LAMP (Linux, Apache, MySQL/MariaDB, PHP) stack for proper operation. Apache web server provides the HTTP service layer, while PHP processes the phpMyAdmin application code. MySQL or MariaDB serves as the underlying database engine that phpMyAdmin manages.
Verify PHP version compatibility, as phpMyAdmin requires PHP 7.2 or newer for optimal functionality. Essential PHP extensions include mysqli, mbstring, zip, gd, and xml modules. These extensions enable database connectivity, character encoding support, compression capabilities, and image processing features within phpMyAdmin.
Preparing the AlmaLinux 10 Environment
System Update and Package Management
Begin by updating your AlmaLinux 10 system to ensure all packages reflect the latest security patches and feature improvements. Execute the following commands to refresh package repositories and upgrade existing installations:
sudo dnf update -y
sudo dnf upgrade -y
The update process may require several minutes depending on your system’s current state and available network bandwidth. Monitor the output for any error messages or package conflicts that might require manual intervention. Reboot the system if kernel updates were installed to ensure all changes take effect properly.
Enable the EPEL (Extra Packages for Enterprise Linux) repository to access additional software packages not included in the standard AlmaLinux repositories:
sudo dnf install epel-release -y
sudo dnf config-manager --set-enabled powertools
Installing LAMP Stack Components
Install Apache web server as the foundation for serving phpMyAdmin’s web interface:
sudo dnf install httpd -y
sudo systemctl start httpd
sudo systemctl enable httpd
Verify Apache installation by checking its service status and ensuring it starts automatically during boot sequences. The service should display “active (running)” status, indicating successful installation and startup.
Install PHP along with essential extensions required for phpMyAdmin functionality:
sudo dnf install php php-mysqlnd php-gd php-xml php-mbstring php-zip -y
These PHP modules provide database connectivity (mysqlnd), image processing (gd), XML parsing (xml), multibyte string handling (mbstring), and compression support (zip). Restart Apache to load the newly installed PHP modules:
sudo systemctl restart httpd
Install MariaDB server for database management:
sudo dnf install mariadb-server mariadb -y
sudo systemctl start mariadb
sudo systemctl enable mariadb
Secure the MariaDB installation using the included security script:
sudo mysql_secure_installation
Follow the prompts to set a root password, remove anonymous users, disable remote root login, and delete test databases. These security measures protect your database server from common attack vectors.
Repository Configuration
Configure additional repositories to access the latest PHP versions and phpMyAdmin packages. Install the REMI repository for updated PHP packages:
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm -y
Enable specific PHP version streams if required for your applications:
sudo dnf module list php
sudo dnf module enable php:8.4 -y
Verify repository configuration by listing available phpMyAdmin packages:
sudo dnf search phpmyadmin
Installing phpMyAdmin
Package Installation Method
Install phpMyAdmin directly from the EPEL repository using DNF package manager:
sudo dnf install phpmyadmin -y
This method automatically handles dependency resolution and installs all required components. The package manager downloads phpMyAdmin along with php-fedora-autoloader and other dependencies. Installation typically completes within a few minutes, depending on network speed and system performance.
Verify the installation by checking installed package information:
sudo rpm -qi phpmyadmin
This command displays version information, installation date, and package description, confirming successful installation completion.
Manual Installation Method
For users requiring the latest phpMyAdmin version or specific customizations, manual installation provides greater control. Download the latest phpMyAdmin release from the official website:
cd /tmp
wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz
tar -xzf phpMyAdmin-latest-all-languages.tar.gz
Move the extracted files to the web server document root:
sudo mv phpMyAdmin-*-all-languages /var/www/html/phpmyadmin
sudo chown -R apache:apache /var/www/html/phpmyadmin
sudo chmod -R 755 /var/www/html/phpmyadmin
Create a symbolic link for easier access if desired:
sudo ln -s /var/www/html/phpmyadmin /var/www/html/pma
Manual installation requires regular maintenance to apply security updates and bug fixes. Monitor the phpMyAdmin website for new releases and update accordingly.
Installation Verification
Confirm phpMyAdmin installation by checking file locations and directory structure:
ls -la /usr/share/phpmyadmin/
ls -la /etc/phpMyAdmin/
Verify PHP module dependencies are satisfied:
php -m | grep -E "(mysqli|mbstring|xml|gd|zip)"
All required modules should appear in the output. Missing modules prevent phpMyAdmin from functioning correctly and require additional PHP extension installation.
Configuring phpMyAdmin
Basic Configuration Setup
phpMyAdmin’s main configuration file requires customization for proper operation. Copy the sample configuration file and edit it:
sudo cp /etc/phpMyAdmin/config.sample.inc.php /etc/phpMyAdmin/config.inc.php
sudo nano /etc/phpMyAdmin/config.inc.php
Generate a random blowfish secret for session security:
openssl rand -base64 32
Insert this generated string into the configuration file:
$cfg['blowfish_secret'] = 'your-generated-secret-here';
Configure database connection parameters:
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
Adjust memory limits and execution timeouts to handle large database operations:
$cfg['memory_limit'] = '512M';
$cfg['max_execution_time'] = 600;
$cfg['max_input_time'] = 300;
Apache Configuration
Edit the phpMyAdmin Apache configuration file to customize access settings:
sudo nano /etc/httpd/conf.d/phpMyAdmin.conf
Configure directory access permissions and IP restrictions:
<Directory /usr/share/phpmyadmin/>
Options Indexes FollowSymLinks
AllowOverride None
Require local
Require ip 192.168.1.0/24
</Directory>
Modify the “Require” directives to match your network configuration. Remove “Require local” if accessing from remote systems, and adjust IP ranges accordingly.
Create a virtual host configuration for dedicated domain access:
<VirtualHost *:80>
ServerName phpmyadmin.yourdomain.com
DocumentRoot /usr/share/phpmyadmin
ErrorLog /var/log/httpd/phpmyadmin_error.log
CustomLog /var/log/httpd/phpmyadmin_access.log combined
</VirtualHost>
PHP Configuration Adjustments
Modify PHP settings to optimize phpMyAdmin performance and functionality:
sudo nano /etc/php.ini
Adjust key parameters for database management operations:
max_execution_time = 600
max_input_time = 300
memory_limit = 512M
post_max_size = 128M
upload_max_filesize = 128M
max_file_uploads = 20
These settings accommodate large database imports and exports while preventing timeout errors during lengthy operations. Restart Apache to apply configuration changes:
sudo systemctl restart httpd
Security Hardening
Access Control Configuration
Implement IP-based access restrictions to limit phpMyAdmin access to authorized networks. Edit the Apache configuration file:
sudo nano /etc/httpd/conf.d/phpMyAdmin.conf
Add specific IP address or network ranges:
<RequireAll>
Require ip 192.168.1.0/24
Require ip 10.0.0.0/8
Require not ip 192.168.1.100
</RequireAll>
Configure HTTP authentication for additional security layers:
sudo htpasswd -c /etc/httpd/.htpasswd admin
Add authentication requirements to the Apache configuration:
<Directory /usr/share/phpmyadmin/>
AuthType Basic
AuthName "phpMyAdmin Access"
AuthUserFile /etc/httpd/.htpasswd
Require valid-user
</Directory>
Database User Security
Create dedicated database users with minimal privileges for phpMyAdmin access. Avoid using the root account for web-based database management:
CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY 'strong-password-here';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON *.* TO 'phpmyadmin'@'localhost';
FLUSH PRIVILEGES;
Implement strong password policies requiring complex passwords with mixed character types, minimum length requirements, and regular password rotation schedules.
Additional Security Measures
Change the default phpMyAdmin URL path to obscure its location from automated scanners:
sudo mv /usr/share/phpmyadmin /usr/share/database-admin
sudo nano /etc/httpd/conf.d/phpMyAdmin.conf
Update all path references in the Apache configuration file to reflect the new directory name. This simple obfuscation technique reduces exposure to automated attack attempts.
Disable unnecessary phpMyAdmin features to minimize attack surface:
$cfg['ShowPhpInfo'] = false;
$cfg['ShowChgPassword'] = false;
$cfg['ShowCreateDb'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;
Firewall Configuration
Firewalld Setup
Configure the firewall to allow HTTP and HTTPS access while maintaining security:
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
Verify firewall rules are active and properly configured:
sudo firewall-cmd --list-all
The output should display HTTP and HTTPS services in the allowed services list. Test connectivity from remote systems to ensure proper access.
Advanced Firewall Rules
Create custom firewall zones for enhanced security control:
sudo firewall-cmd --permanent --new-zone=phpmyadmin
sudo firewall-cmd --permanent --zone=phpmyadmin --add-service=http
sudo firewall-cmd --permanent --zone=phpmyadmin --add-source=192.168.1.0/24
sudo firewall-cmd --reload
Configure rich rules for granular access control:
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.1.100" port protocol="tcp" port="80" accept'
Monitor firewall logs for security events and unauthorized access attempts:
sudo journalctl -u firewalld -f
Testing and Accessing phpMyAdmin
Initial Access and Login
Access phpMyAdmin through your web browser using the server’s IP address or configured domain name:
http://your-server-ip/phpmyadmin
The login screen should display properly, showing the phpMyAdmin interface with username and password fields. Use the database credentials created during MariaDB setup or dedicated phpMyAdmin user accounts.
Navigate through the interface to verify functionality. The main dashboard displays server information, database lists, and administrative options. Test basic operations like creating databases and tables to ensure proper connectivity.
Functionality Testing
Create a test database to verify phpMyAdmin operations:
- Click “New” in the left sidebar
- Enter “test_database” as the database name
- Select appropriate collation (utf8mb4_general_ci recommended)
- Click “Create”
Import sample data to test import functionality:
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) NOT NULL,
email VARCHAR(100) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO users (username, email) VALUES
('testuser1', 'user1@example.com'),
('testuser2', 'user2@example.com');
Test export functionality by exporting the test database in various formats (SQL, CSV, XML). Verify backup and restore capabilities using phpMyAdmin’s export and import features.
Common Issues and Troubleshooting
Installation Problems
Dependency conflicts may occur during installation, particularly with PHP modules. Resolve conflicts by removing conflicting packages and reinstalling:
sudo dnf remove php-mysql
sudo dnf install php-mysqlnd
sudo systemctl restart httpd
Address PHP module missing errors by installing required extensions:
sudo dnf install php-gd php-xml php-mbstring php-zip
Fix file permission issues that prevent phpMyAdmin from accessing configuration files:
sudo chown -R apache:apache /etc/phpMyAdmin/
sudo chmod 644 /etc/phpMyAdmin/config.inc.php
Access and Authentication Issues
Troubleshoot login failures by checking database connectivity and user permissions:
mysql -u root -p
SELECT User, Host FROM mysql.user;
SHOW GRANTS FOR 'username'@'localhost';
Resolve “Access denied” errors by verifying user credentials and database privileges. Check MariaDB error logs for detailed error information:
sudo tail -f /var/log/mariadb/mariadb.log
Fix session timeout problems by adjusting PHP session settings:
session.gc_maxlifetime = 3600
session.cookie_lifetime = 3600
Performance and Configuration Issues
Optimize phpMyAdmin performance for large databases by increasing PHP memory limits and execution timeouts. Edit the PHP configuration file and restart Apache:
sudo nano /etc/php.ini
sudo systemctl restart httpd
Resolve timeout issues during large operations by adjusting both PHP and MySQL timeout settings:
SET SESSION interactive_timeout = 600;
SET SESSION wait_timeout = 600;
Address slow query performance by enabling MySQL slow query logging and analyzing problematic queries:
SET GLOBAL slow_query_log = 'ON';
SET GLOBAL long_query_time = 2;
Best Practices and Maintenance
Regular Maintenance Tasks
Maintain phpMyAdmin security by applying updates regularly. Monitor for new releases and security advisories:
sudo dnf update phpmyadmin
sudo systemctl restart httpd
Implement automated backup strategies for both databases and phpMyAdmin configurations. Create scheduled backups using cron jobs:
0 2 * * * mysqldump -u backup_user -p'password' --all-databases > /backup/mysql_backup_$(date +\%Y\%m\%d).sql
Manage log files to prevent disk space exhaustion. Configure log rotation for Apache and MariaDB logs:
sudo nano /etc/logrotate.d/httpd
sudo nano /etc/logrotate.d/mariadb
Performance Optimization
Configure PHP OPCache for improved application performance:
sudo nano /etc/php.d/10-opcache.ini
Enable and optimize OPCache settings:
opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=2
Implement database query optimization techniques by analyzing slow queries and creating appropriate indexes. Monitor server resources using tools like htop and iotop to identify performance bottlenecks.
Configure MySQL/MariaDB performance tuning parameters:
SET GLOBAL innodb_buffer_pool_size = 1G;
SET GLOBAL max_connections = 200;
SET GLOBAL query_cache_size = 64M;
Congratulations! You have successfully installed phpMyAdmin. Thanks for using this tutorial for installing phpMyAdmin on your AlmaLinux OS 10 system. For additional help or useful information, we recommend you check the official phpMyAdmin website.