This is a fast way to install LAMP in Ubuntu 16.04:

sudo apt-get install apache2
sudo apt-get install mysql-server
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql

Turn mod rewrite on

sudo a2enmod rewrite

Change your sites-available config files to insert AllowOverride All directive:

DocumentRoot /var/www/html

<Directory “/var/www/html”>
AllowOverride All

Restart apache

sudo service apache2 restart