Skip to content

Instantly share code, notes, and snippets.

@dyoungwd
Last active October 31, 2015 10:03
Show Gist options
  • Save dyoungwd/f4b6eb0878d91a9ac250 to your computer and use it in GitHub Desktop.
Save dyoungwd/f4b6eb0878d91a9ac250 to your computer and use it in GitHub Desktop.
Set up LAMP server Fedora
#! /bin/bash
# script to lamp server
# author dyoung0378@gmail.com
#LOG IN AS ROOT BEFORE EXECUTING SCRIPT su -l
#LAMP is an acronym derived from the first letters of the combination of operating system #and open-source software stack. Linux, Apache HTTP server, MySQL/MairiaDB, and PHP/Perl/#Python
#Apache
dnf -y install httpd
#Enable the httpd service to start automatically on every reboot
systemctl enable httpd
#Start httpd service
systemctl start httpd
#Add firewall rules:
firewall-cmd --add-service=http --permanent
#Test to see if the Apache web server is running:
systemctl status httpd.service
#Open a web browser and test to see if it works by typing 127.0.0.1 in the address bar:
#Adjust firewall to allow remote access
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
#Restart firewalld service:
firewall-cmd --reload
#MariaDB
dnf -y install mariadb mariadb-server
#Enable the MariaDB service to run automatically on reboot:
systemctl enable mariadb.service
systemctl enable mysqld
#Start the MariaDB service:
systemctl start mariadb.service
systemctl start mysqld
#Set the SQL Database root password:
mysql_secure_installation
#Login to the SQL database: mysql -u root -p
#PHP
dnf -y install php php-mysql
#Create your first PHP file:
vi /var/www/html/test.php
#Add the lines into test.php without the # and save
#<?php
# phpinfo();
#?>
#Restart the httpd service:
systemctl restart httpd.service
#Test PHP:Open a web browser and type 127.0.0.1/test.php in the address bar
#phpMyAdmin
dnf -y install phpmyadmin
#Configure phpMyAdin visit http://www.unixmen.com/install-lamp-server-apache-mariadb-php-fedora-212019/ and scroll to bottom for instructions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment