×


Install phpMyAdmin on AlmaLinux / CentOS 8 - Follow the steps outlined here ?



phpMyAdmin is an open-source, web-based administration tool written in PHP. Basically, It is a popular tool used for managing MySQL and MariaDB servers. It is used by system administrators for performing activities such as creating and managing databases, users, relations, permissions. It has a simple and user-friendly interface for performing database administration tasks.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related SQL databases queries.

In this context, we shall look into the installation procedure of phpMyAdmin on AlmaLinux system.


Steps to Install Install phpMyAdmin on AlmaLinux

Before installing PHPMyAdmin, you need to have the following requisite packages installed:

  • PHP.
  • Database Server(MySQL or MariaDB).
  • Apache Web server.


1. Install additional PHP modules

The Current version of PhpMyAdmin is compatible with PHP 7.1 and later versions as well as MySQL/MariaDB 5.5 and newer versions. You need to install PHP as well as the MySQL support package for PHP, and other necessary PHP packages for phpMyAdmin to function as expected on your CentOS / AlmaLinux system.

Therefore, run the following command to install the necessary php packages required to utilize PHP with Apache and MySQL:

$ sudo dnf -y install php php-fpm php-mysqlnd php-opcache php-gd php-xml php-mbstring php-zip


2. Install phpMyAdmin

Once the dependencies have been installed, our system is now ready for the phpMyAdmin installation. phpMyAdmin is not available in the system's default repositories, and so you need to download the latest version of the phpMyAdmin archive from the official site. At the time of writing this guide, the current version of phpMyAdmin is 5.1.1

Run the following wget command to download phpMyAdmin zip file:

$ wget https://files.phpmyadmin.net/phpMyAdmin/5.1.1/phpMyAdmin-5.1.1-all-languages.zip

After the download is complete, extract the packages with the below command:

$ unzip phpMyAdmin-5.1.1-all-languages.zip

Next, move phpMyAdmin to the usr/share/phpMyadmin directory:

$ sudo mv phpMyAdmin-5.1.1-all-languages /usr/share/phpMyAdmin

Then, create a tmp directory . Run the command to do this:

$ sudo mkdir -p /usr/share/phpMyAdmin/tmp

Set the necessary permissions with the commands:

$ sudo chown -R apache:apache /usr/share/phpMyAdmin
$ sudo chmod 777 /usr/share/phpMyAdmin/tmp


3. Configure Apache web server for phpMyAdmin

Here, we will configure the web server to serve phpMyAdmin on the network. First, let's create an Apache configuration file for phpMyAdmin:

$ sudo vi /etc/httpd/conf.d/phpmyadmin.conf

Paste the lines below to the apache configuration file. Here, we also create an alias that we will use to access phpMyAdmin:

Alias /phpmyadmin /usr/share/phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
 AddDefaultCharset UTF-8
 <IfModule mod_authz_core.c>
 # Apache 2.4
 <RequireAny>
 Require all granted
 </RequireAny>
 </IfModule>
</Directory>



<Directory /usr/share/phpMyAdmin/setup/>
 <IfModule mod_authz_core.c>
# Apache 2.4
 <RequireAny>
 Require all granted
 </RequireAny>
 </IfModule>
</Directory>

Save and close the file.


4. Configure SELinux and Firewall

For systems with SELinux enabled, run the following command to set correct permissions to allow SELinux policies:

$ sudo chcon -Rv --type=httpd_sys_content_t /usr/share/phpmyadmin/*

Finally, ensure to restart the Apache service for all the changes to take effect. Run the command:

$ sudo systemctl restart httpd

If you have enabled the firewall, you need to allow HTTP traffic. Run the following command to allow HTTP traffic:

$ sudo firewall-cmd --permanent --add-service=http

Next, reload the firewall after making these changes with the below command:

$ sudo firewall-cmd --reload

Finally, let's access the phpMyAdmin web portal. Open your web browser and access PHP my admin with the following address:

$ http://your-server-ip/phpMyAdmin

The browser will now display the phpMyAdmin login page.

You can now Login with your MariaDB root credentials.

You will be directed to the phpMyAdmin dashboard.


[Need assistance in fixing phpMyAdmin issues ? We can help you. ]


Conclusion

This article covers the installation and configuration procedure of phpMyAdmin on CentOS 8 / AlmaLinux 8. It is one of the most popular database administration tools used by hosting companies and system administrators for performing database activities such as creating, deleting, querying tables, columns, relations, indexes, users, permissions, etc. Now, you can create and manage all the databases conveniently without the need of running SQL queries.


More Linux Tutorials

We create Linux HowTos and Tutorials for Sys Admins. Visit us on IbmiMedia.com

Also for Tech related tips, Visit forum.outsourcepath.com or General Technical tips on www.outsourcepath.com