How can I install phpMyAdmin on Oracle Linux 8? In this guide, we are going to look at how to install and use phpMyAdmin on Oracle Linux 8. PhpMyAdmin is an easy to use web interface for the administration of MySQL and MariaDB databases.

Web applications developers need to have a database administration tool. MySQL and MariaDB are the most common open-source database management software. Most experienced developers will use commands to administer these databases. However, phpMyAdmin provides an easy to use web interface for administering MySQL and MariaDB databases. It is suitable for both beginners and experienced developers. With PhpMyAdmin, one can manage databases, tables, columns, relations, indexes, users and permissions among other things through the use of an intuitive web interface.

Install PhpMyAdmin on Oracle Linux 8

To be able to use phpMyAdmin, we require to have installed LAMP stack installed on Oracle Linux 8. LAMP stack is a combination of open source software that help developers build powerful web applications. LAMP is an acronym for Linux, Apache, MySQL and PHP, which are open-source software that work together to build powerful web applications. In this case, Linux is the operating system being used. Apache (httpd in Redhat operating systems) is the web server while MySQL is a database management application. PHP (Hypertext Pre-processor) is the backend programming language.

Step 1: Install Apache, PHP and MariaDB on Oracle Linux 8.

Use the below command to install Apache, PHP and MariaDB and well as other required dependencies.

sudo dnf install mariadb mariadb-server httpd httpd-tools php php-fpm php-cli php-json
php-gd php-mbstring php-pdo php-xml php-mysqlnd -y

Step 2: Start and enable Apache web server.

Once installations have run to completion, start Apache web server and enable it to automatically start on system reboot.

sudo systemctl start httpd
sudo systemctl enable httpd

Ensure that Apache web server is running by checking on its status

sudo systemctl status httpd

If running, the output should be as below:

Step 3: Start and enable MariaDB

Now start MariaDB service and enable it.

sudo systemctl start mariadb
sudo systemctl enable mariadb

Also check mariadb status to confirm it is running

$ systemctl status mariadb

Output

Check php installed version using the command below:

$ php -v

Output

Step 4: Enable php-fpm

We need to enable php-fpm to be used in serving web pages

sudo systemctl enable –now php-fpm

Ensure that php-fpm is running

$ systemctl status php-fpm

The output should be as shown below if running

Step 5: Secure MariaDB and set root password

Run the below command to secure MariaDB and set root password:

$ sudo mysql_secure_installation

Respond to the prompts as shown below:

Enter current password for root (enter for none): Just press Enter
Set root password? [Y/n] Y 
New password:  New-root-password
Re-enter new password: Re-enter New-root-password
Remove anonymous users? [Y/n] Y 
Disallow root login remotely? [Y/n] Y 
Remove test database and access to it? [Y/n] Y 
Reload privilege tables now? [Y/n] Y 
Thanks for using MariaDB!

Let us also create a MariaDB database and a user for PhpMyAdmin. Login to MariaDB with the below command and enter the password set above:

$ mysql -u root -p

Enter the password set above. Once you connect to MariaDB rum the below MySQL commands to create a DB and a user.

CREATE DATABASE mydb;
CREATE USER ‘mydbuser’@’localhost’ IDENTIFIED BY ‘mypassword’;
GRANT ALL ON mydb.* to ‘mydbuser’@’localhost’ IDENTIFIED BY ‘mypassword’;
FLUSH PRIVILEGES;
EXIT

Step 6: Install PhpMyAdmin on Oracle Linux 8

Download the latest English version of PhpMyAdmin using the below command:

VER="5.0.2"
sudo dnf -y install wget tar
wget https://files.phpmyadmin.net/phpMyAdmin/${VER}/phpMyAdmin-${VER}-english.tar.gz

Extract the archived file as below:

tar xvf phpMyAdmin-${VER}-english.tar.gz

Move the extracted content to /usr/share directory

sudo mv phpMyAdmin-${VER}-english /usr/share/phpmyadmin

Next create a directory for phpMyAdmin temp files

sudo mkdir -p /var/lib/phpmyadmin/tmp
sudo chown -R apache:apache /var/lib/phpmyadmin/tmp

Also create directory for phpMyAdmin configuration files such as htpass file.

$ sudo mkdir /etc/phpmyadmin/

Next we create phpMyAdmin configuration file

$ sudo cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php

Now edit the configuration file as below:

$ sudo vim /usr/share/phpmyadmin/config.inc.php

Set a secret passphrase, 32 characters long and configure Temp directory

$cfg[‘blowfish_secret’] = ‘Rta67jRT90YheyvR63Ghtm74ohTHDer4’;
$cfg[‘TempDir’] = ‘/var/lib/phpmyadmin/tmp’;

Step 7: Configure Apache webserver

Create phpMyAdmin Apache configuration file.

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

Add the following content on the file

# Apache configuration for phpMyAdmin 
Alias /phpMyAdmin /usr/share/phpmyadmin/ 
Alias /phpmyadmin /usr/share/phpmyadmin/ 
 
<Directory /usr/share/phpmyadmin/> 
  AddDefaultCharset UTF-8 
 
  <IfModule mod_authz_core.c> 
    # Apache 2.4 
    Require all granted 
  </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>

Save the file and restart httpd

$ sudo systemctl restart httpd

Step 8: Configure Selinux and firewall

If Selinux is enforcing, you need to allow httpd to serve content in the directory otherwise you will get a permission denied error.

$ sudo semanage fcontext -a -t httpd_sys_content_t "/usr/share/phpmyadmin(/.*)?"
$ sudo restorecon -Rv /usr/share/phpmyadmin

Allow http port in the firewall.

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

Step 9: Access phpMyAdmin web interfaces

After successful installation, access phpMyAdmin web interface with http://<your-server-ip>/phpmyadmin. You should see the login page open as shown.

Login with the MySQL user you created and you should access phpMyAdmin interface as shown:

You have successfully installed phpMyAdmin on Oracle Linux 8. Enjoy your developments and check out more interesting Linux guides below:

Web Development courses:

$15.14
$151.37
in stock
Udemy.com
(181016)
$15.14
$151.37
in stock
Udemy.com
(62645)
$15.14
$151.37
in stock
Udemy.com

LEAVE A REPLY

Please enter your comment!
Please enter your name here

one × 1 =