How to install a LAMP server on Debian and Ubuntu

A quick tutorial how to install a LAMP server with basic functionality.
As you probably already know LAMP is an acronym for:

L => Linux
A => Apache
M => Mysql or recently MariaDB (also in our example)
P => PHP

Tested on: Ubuntu 16.04 and Debian 9.5

Install packages:

apt-get install apache2 php libapache2-mod-php php-mysql php-mbstring mariadb-server mariadb-client

Enable rewrite Apache2 module and restart the web server.

a2enmod rewrite
systemctl restart apache2

Set root MariaDB password:

mysql -u root
use mysql;
UPDATE user SET password=PASSWORD("my_dummy_password_here") WHERE user='root';
FLUSH PRIVILEGES;

Leave a Reply

Your email address will not be published. Required fields are marked *