Installing A LAMP Stack In Oracle Linux 8.5 And VMware

LAMP is the accumulation of software that allows you to host a website on your local Linux system.  This tutorial presumes you have a minimal install of Oracle Linux 8.5  You need to be logged in to the server using Putty or equivalent as an administrator.
I highly recommend you create a new document in NotePad++ or your favorite text editor.  Copy the commands found below into your new document where you can then make changes such as server name, user name etc.  You can then copy and paste these lines of code one at a tine into Putty.  This will give you a reliable document showing exactly how you created your AMP installation
For this tutorial we will be using the local domain 192.168.1.140/test.
Now lets get started.

Updates, Apps and Repositories


Updates, apps and repositories.
sudo dnf -y update
sudo dnf -y install yum-utils
sudo dnf -y install wget tar perl
sudo dnf -y install nano


Apache (httpd)


Install Apache web server (httpd).
sudo dnf -y install httpd

Start Apache.
sudo systemctl start httpd

Apache needs to start at boot.
sudo systemctl enable httpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.servico /usr/lib/systemd/system/httpd.service.

Allow web traffic through the firewall.
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
sudo systemctl restart firewalld
sudo systemctl start httpd

Verify the Apache install by entering your ip address in you browser.


PHP


Install PHP and everything that goes with it.
sudo dnf module list php
sudo dnf module reset php
sudo dnf module install php:7.4
sudo dnf -y install php-curl php-zip
sudo dnf -y install php php-fpm php-mysqlnd php-opcache php-gd php-xml php-mbstring

Verify php version.
php -v

Restart Apache.
sudo systemctl restart httpd.service

Verify the PHP installation by creating the info.php file and executing it.
sudo nano /var/www/html/info.php

Put the folowing text in the file created and save it.
<?php
phpinfo();
?>
Now enter your ip address followed by /info.php in your browser and execute it.

Remove the info.php file.
sudo rm /var/www/html/info.php


Maria DB


Install MariaDB.
sudo dnf -y install mariadb-server mariadb

Start the MariaDB service.
sudo systemctl start mariadb.service

MariaDB needs to start at boot.
sudo systemctl enable mariadb.service

To confirm that MariaDB daemon is running, run the command.
sudo systemctl status mariadb

Secure the MariaDB installation and follow the onscreen instructions.
sudo mysql_secure_installation

Enter current password for root (hit Enter for none as you do not have one yet):

Just hit ENTER and follow the prompts on the screen.

OK, successfully used password, moving on…

Set root password? [Y/n] y
New password: (enter your new password)
Re-enter new password: (reenter your new password)
Password updated successfully!
Reloading privilege tables..
… Success!

Remove anonymous users? [Y/n] y
… Success!

Disallow root login remotely? [Y/n] y
… Success!

Remove test database and access to it? [Y/n] y

– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!

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!