Debian/Ubuntu LAMP Setup

| | | | | | | | |

The following code is for Debian 9 Stretch but should work on older Debian with minor changes

#!/bin/sh

#  LAMP_Setup.sh
#  
#
#  Created by David Kittell on 1/18/18.
#  

sudo apt -y update
sudo apt -y upgrade

sudo apt install -y apache2 apache2-utils
systemctl status apache2
sudo systemctl start apache2
sudo systemctl enable apache2
sudo apache2 -v

sudo apt install -y curl
publicIP=$(curl -s https://kittell.net/ip.php)
echo $publicIP

sudo chown www-data:www-data /var/www/html/ -Rv

sudo apt install -y mariadb-server mariadb-client
systemctl status mariadb
sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo mysql_secure_installation
mariadb --version

sudo apt install -y php libapache2-mod-php php-mysql php-common php-cli php-common php-json php-opcache php-readline
sudo a2enmod php
sudo systemctl restart apache2
php --version
echo "<?PHP phpinfo() ?>" | sudo tee /var/www/html/info.php
Originally Posted on January 18, 2018
Last Updated on January 31, 2019
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.