Greeting Everyone,
Installation of LAMP Stack in RedHat 8, CentOS Stream and Oracle Linux 8
First of all, during apache server installation its completely up to you and can begin with whatever you like either apache or mariadb or php. I will start in LAMP format which is Linux first and it obviously already installed then apache, mariadb then finally, php
Update your system
# dnf update -y
Install Apache (httpd)
# dnf install httpd httpd-tools
Start and Enable Apache (httpd)
# systemctl start httpd# systemctl enable httpd# netstat -tnlp
Give permission to Apache and check website
# chown apache:apache -R /var/www/html# echo “welcome to the site” >> /var/www/html
Install MariaDB
# dnf install mariadb-server mariadb
Enable MariaDB
# systemctl start mysqld# systemctl enable mysqld
Mysql installation to create user and pass
# mysql_secure_installation
create a root password and selected Y to all
# mysql -u root -pMariaDB> exit;
Install php
# dnf install php php-fpm php-xml php-mysqlnd php-gd php-mbstring
Enable php-fpm
# systemctl start php-fpm# systemctl enable php-fpm
Enable SELINUX to allow apache to execute PHP-FPM
# setsebool -P httpd_execmem 1
Enable firewall for port 80, 443 and 3306
# systemctl status firewalld# systemctl start firewalld# firewall-cmd --permanent --zone=public --add-port=80/tcp# firewall-cmd --permanent --zone=public --add-port=443/tcp# firewall-cmd --permanent --zone=public --add-port=3306/tcp
# firewall-cmd --reload
# firewall --list-all
Test php
# echo “<?php phpinfo() ?)” >> /var/www/html/info.php# links http://localhost/info.php