Debian/Ubuntu LAMP Setup

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

sudo apt update
sudo apt upgrade

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

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

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

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

sudo apt install php7.0 libapache2-mod-php7.0 php7.0-mysql php-common php7.0-cli php7.0-common php7.0-json php7.0-opcache php7.0-readline
sudo a2enmod php7.0
sudo systemctl restart apache2
php --version
echo "<?PHP phpinfo() ?>" | sudo tee /var/www/html/info.php
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.