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 10 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.
Check our tutorial on how to configure LAMP stack after installation