LAMP is an acronym for a set (complex) of server software widely used on the World Wide Web. LAMP is named after the first letters of its constituent components:

  • Linux is the operating system on which the web application infrastructure is deployed;

  • Apache - the web server;

  • MariaDB / MySQL - used to work with databases ;

  • PHP - programming language used to create web applications.

First let's update the information about the packages in the repositories:

# apt-get update

Now you can install the software.

Installing Apache

To do this at the command line, type:

# apt-get install apache2

Installing MySQL

Enter the command:

# apt-get install mysql-server mysql-client

During the installation you will be asked for the root password for the mysql-server, it is better to set a more difficult password to avoid hacking.

Installing PHP*

You can use the command:

# apt-get install php5 php5-mysql

This will also install the base set of PHP extensions and the PHP module for Apache - libapache2-mod-php5

Add site

If you plan to host more than one site, you will need to create VirtualHost for all sites in the Apache configuration files.

On Debian, VirtualHosts are connected from a separate directory /etc/apache2/sites-enabled/

It is also best to create a separate file for a separate domain and name it with the name of the domain.

Creating a configuration file for a domain

To create a file run the command

touch /etc/apache2/sites-enabled/  

Open it for editing in a text editor:

<VirtualHost >  
       DocumentRoot /var/www/sites/
       CustomLog /var/www/httpd-logs/ combined
       ErrorLog /var/www/httpd-logs/
       AddType application/x-httpd-php .php
  • Instead of - use server IP,

  • Instead of - domain name.

Creating a database in MySQL

You need to create a database for the site.

mysql -u root -p  

Create a database and give user rights to it:

create database db;  
grant all privileges on db.* to 'user'@'localhost' identified by 'password';  
  • db - base name,

  • user - name of the user to be created,

  • password - password.

Creation of the site directory and installation of CMS*

Create directories for the site and logs, as well as log files themselves:

mkdir /var/www/sites/  
mkdir /var/www/sites/  
mkdir /var/www/httpd-logs  
touch /var/www/httpd-logs/  
touch /var/www/httpd-logs/  

To install the CMS, go to the domain directory and download the distribution of the desired CMS:

cd /var/www/sites/  

Then unzip the downloaded archive:


Now, if your DNS records lead correctly to your server, you can go to the site to continue the installation by domain, and if not, then by IP address.

Updated Feb. 11, 2019