Install and setup a Lamp Stack in Debian/Ubuntu server

How to install a web server in debian based systems (Apache + PHP + MySQL + PHPmyadmin)

Install Apache

Install apache web server with the following command:

Give rights to the apache file that you can easily manage your sites. To do this, run the following commands:

Now enable mod_rewrite for apache to understand rewrite rules:

Then we need to restart apache:

We need to make sure the mod_rewrite works properly without any problems, edit apache2.conf and make just a change in one line. Run the following command:

Scroll down and search for this pice of code:

Change AllowOverride None to AllowOverride All, close and save. Then restart apache.

Install PHP

Install PHP with the following command:

This will ask you a few questions in order to configure your installation correctly.

Enable the mbstring PHP extension, run this command:

Afterwards, restart Apache for your changes to be recognized:

Install MySQL

Install your database with the following command:

When the installation is done restart Apache:

PHPMyAdmin

If you like to have a UI to manage your databases you can install phpmyadmin with the following command:

Follow the instruction to setup phpmyadmin. Check our [Github]() and use the .sh files to make it easier.

----------

Home

Linux

Notes

MicroLog

----------

© DarknessCode