Lamp script for CentOS 8

Here is a simple lamp install script for CentOS 8.

#!/bin/bash
#update system
dnf update
#install apache
dnf install httpd httpd-tools -y
systemctl enable httpd
systemctl start httpd
systemctl status httpd
#update firewall
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
#install mariadb
dnf install mariadb-server mariadb -y
systemctl start mariadb
systemctl enable mariadb
systemctl status mariadb
mysql_secure_installation
# Install PHP 7 on CentOS 8
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
#dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm
#dnf module list php
dnf install php php-opcache php-gd php-curl php-mysqlnd -y
systemctl start php-fpm
systemctl enable php-fpm
systemctl status php-fpm
setsebool -P httpd_execmem 1
systemctl restart httpd

Check the installation

# nano /var/www/html/info.php

Insert the PHP code below and save the file.


[/bash]
Then head out to your browser, and type the URL below. Remember to replace the server IP address with your server’s actual IP address.

http://server-ip-address/info.php

Leave a Comment