05 March 2022

Install PHPMyAdmin With Apache On Fedora 28/29/30/31/32

The easy way to administer database server such as mysql server, mariadb server, percona server and the like is using phpmyadmin. Phpmyadmin is a php app that can interact with database server easily. This time, I will cover how to install and configure phpmyadmin on Fedora 28/29/30/31 so that you can let yourself administer the database server via web browser.

1. Install apache

yum install httpd

Start apache

systemctl start httpd

Restart apache

systemctl restart httpd

Status of the apache

systemctl status httpd

2. Install php

yum install php php-mysqlnd

To test that php can run on apache, follow these steps.

a. Create file named info.php

nano /var/www/html/info.php

b. Add the following lines inside of the file.

<?php // Show all information, defaults to INFO_ALL phpinfo(); // Show just the module information. // phpinfo(8) yields identical results. phpinfo(INFO_MODULES); ?>

c. Visit http://ip_address/info.php with a web browser app. You should see the following page if the php is working on apache server.

Install PHPMyAdmin With Apache On Fedora 28/29/30/31/32

3. Install mariadb server

yum install mariadb-server

Start Mariadb Server

systemctl start mariadb

Restart Mariadb Server

systemctl restart mariadb

Status of Mariadb Server

systemctl status mariadb

Secure the mariadb-server installation.

mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. Set root password? [Y/n] y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] y ... Success! By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!

Install PHPMyAdmin With Apache On Fedora 28/29/30/31

To install phpmyadmin, follow these steps.

1. Run the following via command line

yum install phpmyadmin

2. Modify phpmyadmin configuration file.

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

3. Replace the following lines.

<Directory /usr/share/phpMyAdmin/> AddDefaultCharset UTF-8 <IfModule mod_authz_core.c> # Apache 2.4 <RequireAny> Require ip 127.0.0.1 Require ip ::1 </RequireAny> </IfModule> <IfModule !mod_authz_core.c> # Apache 2.2 Order Deny,Allow Deny from All Allow from 127.0.0.1 Allow from ::1 </IfModule> </Directory>

With the following lines

<Directory /usr/share/phpMyAdmin/> AddDefaultCharset UTF-8 <IfModule mod_authz_core.c> # Apache 2.4 <RequireAny> Require ip 127.0.0.1 Require ip ::1 Require all granted </RequireAny> </IfModule> <IfModule !mod_authz_core.c> # Apache 2.2 Order Deny,Allow Deny from All Allow from 127.0.0.1 Allow from ::1 </IfModule> </Directory>

In this case, "Require all granted" is the line we have added into the phpmyadmin configuration file.

4. Restart apache

systemctl restart httpd

5. Visit http://ip_address/phpmyadmin to accesss phpmyadmin app.

Install PHPMyAdmin With Apache On Fedora 28/29/30/31/32

6. Enter the username and password you have provided. In this case, the default username is root and the password is the one you have provided when securing the mariadb server installation.

Install PHPMyAdmin With Apache On Fedora 28/29/30/31/32

Comments are closed