How to Install LAMP on Debian 11

Learn how to setup a Linux, Apache, MySQL and PHP development server on your Debian instance.

How to Install LAMP on Debian 11
LAMP-Stack

LAMP or Linux, Apache, MySQL and PHP stack is a free, open-source web stack that is used to host web applications on a Linux distribution.  LAMP is easy to configure and works efficiently for setting up multiple web applications on a single instance.

In this short tutorial, We will show you how to install LAMP stack on Debian 11 and other Debian based distributions.

Getting Started

If you are running this on a production environment, ensure that you have performed tasks to secure the server.

Next, ensure all the packages are updated with the command:

sudo apt-get update && sudo apt-get upgrade

Installation

We need to install the packages required to setup the complete LAMP stack. We will start by installing the Apache server, MySQL database and finally PHP.  You can install the stack as a bundled version using tasksel as we will cover later.

Installing Apache

To install Apache on your server, simply enter the command:

sudo apt-get install apache2 -y

Installing MySQL package

Install MySQL package with the command:

sudo apt-get install mysql-server -y

Installing PHP and Dependencies.

In this step, we are going to install PHP, PHP extensions and Application Repo, Apache Support, MySQL support with the command:

sudo apt-get install php7.3 libapache2-mod-php-7.3 php-mysql -y

You can also add support such as cURL, JSON or CGI by install the following packages:

sudo apt-get install php-curl php-json, php-cgi -y

Installing LAMP stack with Tasksel

You can choose to install the LAMP stack as a single package using tasksel. Simply enter the command:

sudo apt-get install tasksel -y
sudo tasksel install lamp-server

Once completed, you can start to perform various configurations to ensure the server is secured and works correctly.

Conclusion

And that's it for this one. In this guide, we covered the steps required to install and setup LAMPP on Debian 11 and other Debian flavors.

Thanks for reading and Catch you in the next one.

If you enjoy our content, please consider buying us a coffee to support our work:

Table of Contents
Great! Next, complete checkout for full access to GeekBits.
Welcome back! You've successfully signed in.
You've successfully subscribed to GeekBits.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.