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:

    # yum makecache
    

    Now you can install the software.

    Installing Apache*

    To do this at the command line, type:

    # yum install httpd
    

    Installing MySQL

    Enter the command:

    # yum install mysql-server mysql-client
    

    After installation is complete, you must run mysql and reset the password:

    # /etc/init.d/mysqld start
    # /usr/bin/mysqladmin -u root password 'new-password
    

    Installing PHP

    You can use the command:

    # yum install php php-mysql
    

    This will also install the base set of PHP extensions and the PHP module for Apache.

    Add site

    In case you plan to host more than one site on the server, you need to create VirtualHost for all sites in the Apache configuration files.

    In CentOS, VirtualHosts are connected from a separate directory /etc/httpd/sites-enabled/

    To do this, you need to create it:

    mkdir /etc/httpd/sites-enabled/  
    

    And add a line to the Apache configuration file:

    Include sites-enabled/*.conf  
    

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

    Create a configuration file for the domain.

    To create a file run the command

    touch /etc/httpd/sites-enabled/mysite.com.conf  
    

    Open the file for editing with any text editor you like and write into it:

    <VirtualHost 111.111.111.111:80 >  
           ServerName mysite.com
           ServerAlias www.mysite.com
           DocumentRoot /var/www/sites/mysite.com
           CustomLog /var/www/httpd-logs/mysite.com.access.log combined
           ErrorLog /var/www/httpd-logs/mysite.com.error.log
           AddType application/x-httpd-php .php
    </VirtualHost>  
    
    • Instead of 111.111.111.111 - use server IP,
    • Instead of mysite.com - 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/mysite.com  
    mkdir /var/www/httpd-logs  
    touch /var/www/httpd-logs/mysite.com.access.log  
    touch /var/www/httpd-logs/mysite.com.error.log  
    

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

    cd /var/www/sites/mysite.com  
    wget https://ru.wordpress.org/latest-ru_RU.zip  
    

    Then unzip the downloaded archive:

    unzip wordpress-4.9.4-en_RU.zip  
    

    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.

    Important! Do not run the installation on servers with a control panel, as it may lead to data loss.