A LAMP based web hosting is the combination of Linux, Apache, MySQL & PHP. This tutorial will help you with the installation of LAMP environment on your Debian 10 Linux system.
You must have sudo privileges account access to the Debian 10 Linux system. Login to your Debian 10 system and upgrade the current packages to the latest available version.
sudo apt update sudo apt upgrade
Also, install the below packages on your system required for commands next in this tutorial.
sudo apt install ca-certificates apt-transport-https
Install Apache Web Server
The Debian 10 base repositories contain Apache 2.4 packages. You can simply install Apache2 packages by running the following command:
sudo apt install apache2
Install MySQL Server
Debian 10 base repository contains MariaDB (Replacement of MySQL) as default database server. If you are okay to go with MariaDB execute commands to install else follow MySQL server installation tutorial.
sudo apt install mysql-server
Default Debian 10 system repositories contain an older PHP version. To install the latest PHP version add a third-party PPA to your system. Run the below command to add PPA to your system.
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add - sudo echo "deb https://packages.sury.org/php/ buster main" | tee /etc/apt/sources.list.d/php.list
Then install the latest PHP version on Debian 10.
sudo apt update sudo apt install php php-mysql libapache2-mod-php
To verify the LAMP setup on your system, Create a PHP script with phpinfo() function under Apache document root. To do this, edit /var/www/html/info.php file in your favorite text editor and add below content to the file and save it.
Now access the info.php file in the web browser using your system IP address.
You have a running LAMP environment on your Debian 10 Buster Linux system.