The following script installs Apache, MySQL and PHP as well as PHPMyAdmin and some tweaks. For Debian based systems including Ubuntu. To install, copy the script to the server and run in the same folder you copied the file to by running the command:

bash lamp.sh

Here is the script code:

View the Gist on Github