Below are notes on how to set up a LAMP server and what worked for me (plus many references already on this topic).
sudo apt install apache2
sudo apt install mysql-server
sudo apt-add-repository ppa:ondrej/php
sudo apt install php-pear php-fpm php-dev php-zip \
php-curl php-xmlrpc php-gd php-mysql php-mbstring \
php-xml libapache2-mod-php # If this fails, take out whatever doesn't work?
sudo service apache2 restart
# Restart and check that apache works (go to browser and visit localhost)
# Also check php is working
php -r 'echo "\n\nYour PHP installation is working fine.\n\n\n";'
Optional: Configure network static IP
sudo apt update
sudo apt install mysql-server
sudo mysql_secure_installation #Set root password
sudo mysql
SELECT user,authentication_string,plugin,host FROM mysql.user;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'rootpassword';
FLUSH PRIVILEGES;
exit
sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-5.5 mysql-client-core-5.5
sudo rm -rf /etc/mysql /var/lib/mysql
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get update
sudo apt-get install mysql-server
Setup SFTP protocol for transferring files
sudo apt-get install vsftpd
sudo service vsftpd start
ftp localhost
(use normal login credentials), or