Bismillah…
Instructions to Install Apache, PHP, and MySQL on Oracle Linux 8
Install Apache Web Server
Installs the Apache HTTP server.
Enable and Start Apache
sudo systemctl restart httpd
Enables Apache to start on boot and restarts it to apply changes.
Configure Firewall
sudo firewall-cmd –reload
Opens HTTP (port 80) on the firewall and reloads the firewall to apply the rule.
Install PHP
sudo dnf module reset php
sudo dnf install @php:7.4
sudo dnf install php-mysqli
Lists available PHP modules, resets the PHP module, and installs PHP 7.4 with MySQL support.
Allow Apache to Connect to External Databases (optional)
Configures SELinux to allow Apache to connect to databases over the network.
Set Permissions for Apache
# if you have folder to store uploaded file (optional)
sudo chcon -R -t httpd_sys_rw_content_t docsuploaded
find /var/www/html -type d -exec chmod 755 {} ;
find /var/www/html -type f -exec chmod 644 {} ;
systemctl restart httpd
Changes ownership of files to Apache, sets security context for directories, adjusts file permissions, and restarts Apache.
Install MySQL Server
yum-config-manager –disable mysql-8.4-lts-community
yum-config-manager –disable mysql-tools-8.4-lts-community
yum-config-manager –enable mysql80-community
yum-config-manager –enable mysql-tools-community
yum repolist enabled | grep mysql
sudo yum module disable mysql
yum install mysql-community-server
Installs MySQL Community Edition, disables unnecessary repositories, and installs the MySQL server.
Start MySQL and Check Status
systemctl status mysqld
Starts the MySQL server and checks its status.
Retrieve MySQL Temporary Root Password
Fetches the temporary root password for MySQL from the log file.