LAMP (Linux, Apache, MySQL/MariaDB and PHP) on Debian 10 (Buster) Linux

As we all know, LAMP is widely used in Web Hosting companies.  LAMP is a collection of Linux, Apache, MySQL/MariaDB and PHP software. This article helps you to create LAMP environment on Debian 10 (Buster) Linux. 

LAMP Stack comprises of the following software.
Linux : Operating System
Apache : Web Server
MySQL/MariaDB Database : RDBMS (Relational Database Management System)
PHP : Scripting / Programming used for web application development.
Prerequisites
1. Running Debian 10 Linux System.
2. Sudo access
3. Internet access to download packages
Step 1 – Update your system
$ sudo apt update
Step 2 – Installation of Apache Web Server
$ sudo apt install apache2 apache2-utils

Note: Mount ISO file with below command if required.
$ sudo mount -o loop /tmp/debian-10.2.0-amd64-DVD-1.iso /media/cdrom
After successful installation, Apache2 service should start automatically. Check the status of Apache Service
$ sudo systemctl status apache2

How to start if Apache Service is not started automatically.
$ sudo systemctl start apache2
$ sudo systemctl enable apache2
Check Apache version on your system
$ sudo apache2 -v 


Step 3 – Check Working of Apache
Now, it is time to check working of Apache Web Server, open web browser and type IP address of your system. It should Apache Web Server page as shown below.

If UFW Firewall is enable in your system, use below command to allow Apache2 Service Port 80.
$ sudo ufw allow http
$ sudo ufw status
ALSO READ : How to Start / Stop or Enable / Disable Firewall Service on Red Hat / CentOS and Debian / Ubuntu Linux
Step 4 – MySQL Installation

Follow MySQL Installation steps here.

Step 5 – PHP Installation
Install PHP, PHP Extension and Application Repository, Apache support and MySQL support.
$ sudo apt install php php-common php-mysql php-gd php-cli libapache2-mod-php

Check installed PHP version on your system.
Create sample info.php page.

$ sudo echo “<?php phpinfo(); ?>” | sudo tee /var/www/html/phpinfo.php
Check Working of PHP
Once PHP is installed, create a sample info.php page in your document root directory (/var/www/html) and also restart Apache2 Service.

Open Web Browser and enter IP Address with info.php (192.168.56.116/info.php) in browser address bar as shown below. 
Note: This may be vary on your setup.

READ ALSO: Debian GNU/Linux 10 Codename (Buster) Installation Guide
That’s it! In this article, we have seen LAMP Installation on Debian 10 Linux (Buster). Please share it with others and use comment box below to raise a query if any. Also Like us Our Facebook Official Page.

Leave a Comment