Introduction
LAMP stands for Linux, Apache, MySQL, and PHP. Together, they provide a proven set of software for delivering high-performance web applications. Each component contributes essential capabilities to the stack.
It is a set of programs or libraries that when installed on a computer, allow you to transform it into a Web server. This makes it one of the first things to do to start deploying dynamic websites.
This article will explain how to install the LAMP on Debian 11.
Install Apache web server
- Update the package index.
$ sudo apt update
- Install the apache web server by using the following command.
$ sudo apt install apache2
- Enabling the apache2 web server.
$ sudo systemctl enable apache2
- Start the apache2 web server.
$ sudo systemctl start apache2
- Upon starting the Apache web server, make sure to check the status of the server.
Output$ sudo systemctl status apache2
Install MariaDB
- Install the MariaDB server by running the following command.
$ sudo apt-get install mariadb-server -y
- Starting the MariaDB.
$ sudo systemctl start mariadb
- Enable the MariaDB.
$ sudo systemctl enable mariadb
- Upon starting the MariaDB, make sure to check its status.
Output$ sudo systemctl status mariadb
-
For securing your database run the below command and provide the required answers as desired.
$ sudo mysql_secure_installation
Output
Install PHP
- Install PHP and PHP extensions.
$ sudo apt install php php-cli php-mysql libapache2-mod-php php-gd php-xml php-curl php-common -y
- Verify the PHP installation.
Edit the file with the following code.$ sudo nano /var/www/html/info.php
Save and close the file.<?php phpinfo(); ?>
- Now, open the browser and enter the following URL to verify PHP information.
(your_instance_IPv4_address)/info.php
Output - ( as per the screenshot below PHP 7 got installed )