Installing LAMP Webserver In Debian 11

In this video, I show you how to install Apache, MariaDB, PHP 7/8, and phpMyAdmin in Debian 11. I’ll also show you how to configure virtualhosts, configure port forwarding, and setting up a domain to use with your server.


00:00 Intro
00:34 Installing Apache
01:11 Installing Curl
01:39 Installing MariaDB
02:40 Stopping and Starting Apache and MariaDB
03:51 Installing PHP 7.4 and 8
06:14 Installing phpMyAdmin
08:28 Setting Up Virtualhosts
12:37 Accessing Webserver Over The Internet


Installing Apache
👉🏾 apt install apache2

Starting, Stopping, and Reloading Apache
👉🏾 systemctl start apache2
👉🏾 systemctl stop apache2
👉🏾 systemctl reload apache2

Checking Apache Status
👉🏾 systemctl status apache2


Installing Curl
👉🏾 apt install curl


Installing MariaDB
👉🏾 apt install mariadb-server


Setting MariaDB Secure Credentials
👉🏾 sudo mysql_secure_installation


Starting and Stopping MariaDB
👉🏾 systemctl start mariadb
👉🏾 systemctl stop mariadb


Re-creating Database Root User
mysql -u root
DROP USER ‘root’@’localhost’;
CREATE USER ‘root’@’%’ IDENTIFIED BY ‘enter_password_for_root_here’;


Login To Database
mysql -u username -p


Installing PHP 7.4
apt install php
apt install php libapache2-mod-php php-mysql


Installing PHP 8
apt install -y lsb-release ca-certificates apt-transport-https software-properties-common

echo “deb $(lsb_release -sc) main” | sudo tee /etc/apt/sources.list.d/sury-php.list

wget -qO – | sudo apt-key add –

apt update
apt install php8.0


If PHP Is Not Executing, Try The Following Command Change the PHP Version To Your Version You Install

sudo a2dismod mpm_event && sudo a2enmod mpm_prefork && sudo a2enmod php8.0


Installing phpMyAdmin
apt install phpmyadmin


Original article which was used to help make this video 👉🏾