This post is part of a series of posts categorized as “Wiki” that contain basic how-to information. The intent is to create a reference repository for myself, but I’m not selfish so if anyone else can also benefit from it then I’m happy to share the knowledge!
Install Apache.
$ apt install apache2
If using Uncomplicated Firewall with your server then allow web traffic. See https://help.ubuntu.com/community/UFW for more information.
$ ufw allow in "Apache Full"
Install MySQL.
$ apt install mysql-server
Secure MySQL by running the MySQL program mysql_secure_installation. See https://dev.mysql.com/doc/refman/5.7/en/mysql-secure-installation.html for more information.
$ mysql_secure_installation
Further secure MySQL by requiring root to use the native password instead of auth_socket.
$ mysql
$ alter user 'root'@'localhost' identified with mysql_native_password by 'secure password';
$ flush privileges;
$ exit;
Install PHP with Apache and MySQL packages.
$ apt install php libapache2-mod-php php-mysql