Installation of a web server LAMP (Linux, Apache, MySQL, PHP)

The acronym LAMP defines a set of applications essential for a web server functioning : Linux + Apache + MySQL + PHP/Perl/Python.

This tutorial is made to set up and configure step-by-step a LAMP server with PHP.

Apache installation

At first, it is important to install Apache on the concerned machine via the following command :

It will be essential to know the machine’s IP address to install from ifconfig.

MySQL installation

Then, you need to install MySQL via the following command :

During the installation, you will be asked to choose a password root.

It is advised to carefully choose your password preferably alphanumeric and including special characters.

To continue with the installation, the following command must be executed :

Enter your password root when requested and confirm the 4 following questions with yes :

PHP installation

Finally, all there’s left is to install PHP via the following command.

By responding yes to the question, the installation operates.

To conclude, it is essential to restart the apache service :


At first, we are going to check that PHP works by creating our first file on the server :

the page is available from the URL adapted to your IP address

PHP manual

Your LAMP server with PHP is now operational and usable.

Installation of a web server LAMP (Linux, Apache, MySQL, PHP)