安装环境:
Linux 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
1、首先安装mysql
sudo apt-get install mysql-server mysql-client

2、安装apache2
sudo apt-get install apache2

3、安装php7
sudo apt-get install php7
注意:此时是无法解析php网页的,因为没有安装apache php module
4、安装apache2 php7 module
sudo apt-get install libapache2-mod-php7.0
5、测试php是不是正常工作
sudo mv /var/www/html/index.html /var/www/html/index.html.bak
sudo echo “<?php phpinfo();?>” > /var/www/html/index.php
sudo service apache2 restart
6、打开浏览器,输入localhost或者127.0.0.1会看到下图,就代表LAMP配置好了。

注意:这里没有测试Mysql是否正常,请自行实验。