LAMP is one of the most widely used software stacks on servers because it allows us to get a working web server up and running quickly. So, in this post, you will learn how to use LAMP on Debian as well as a description of its main components.
What is LAMP?
The acronym LAMP refers to a set of software needed to achieve dynamic web servers with reduced effort. In a nutshell, by installing each of its components, we can obtain a web server that can serve dynamic websites to everyone else.
One of the main successes of the LAMP stack is that it is very easy to install. Perhaps, the most complex thing is to install the system, but Linux in this aspect has advanced a lot, and now it is easier.
Yes, the LAMP stack refers to Linux, Apache Web server, MySQL / MariaDB, and PHP where each has its specific function and can be combined to run complex web applications.
So, let’s go step by step through each of them.
Install LAMP on Debian 11
Install Debian 11 Bullseye
Debian GNU/Linux is one of the most emblematic distributions of all Linux. It is the mother of the mighty Ubuntu and Linux Mint but Debian is even more stable than them. This is thanks to a rigorous development model that, although sometimes very strict, allows to keep the quality of the added packages high and therefore the stability.
Debian is used on the desktop by many developers but is also widely popular on servers of all kinds. It is not uncommon to find that many web servers use Debian to serve the web pages they have.
The Debian 11 installation process has improved over the past. We now have an improved installer that makes the process as easy as in other distributions.
This process, we show you step by step in our post
There you will find the whole process in detail and at the end, you will have a Debian server ready for LAMP.
Install Apache web server on Debian 11
Apache Web Server is one of the most popular web servers thanks to its ease of use and compatibility with many different operating systems. Thanks to Apache many websites are available today.
Being a project of the Apache Foundation, it is open source and with a license that we can take advantage of to use the software in almost any circumstance.
To install it in Debian 11, we have to connect to our server through SSH and once inside we can execute
sudo apt update sudo apt install apache2
This way it will be installed on the system, but there are still some things to do. These things you can know in our post
How to install and secure Apache web server on Debian 11?
This way you will have an Apache Web server installed and secured to take full advantage of it.
Install PHP on Debian 11
PHP is a web-focused programming language. Thanks to it, you can create web applications and dynamic websites. That is to say that they can process information or data of the users obtained by a form and to make other tasks of processing.
Although PHP is not the only language that can do this on the server-side, it is indeed the most popular and most used.** Major frameworks such as Laravel are based on PHP** and other tools such as PHP Composer are proving vital for development tasks.
Another great feature of PHP is that it is present in the official Debian 11 repositories. So, to install it you can run the following command
sudo apt install php
You also have to install the libapache2-mod-php
package which is the module that allows Apache to process PHP files.
So, the command in question would look like this
sudo apt install php libapache2-mod-php
However, we also have another post that can help you with PHP and its modules.
How to install PHP on Debian 11?
Now with Debian, Apache web server, and PHP, the only thing left is the database handler.
Install MariaDB on Debian 11
Every web application needs a database driver that can store the data it needs to work. In LAMP, one such component is MariaDB.
MariaDB is a derivative of MySQL so we can find a robust, popular, documented database manager that is compatible with many web applications around the world.
Also, MariaDB is available from the official Debian repositories so installation is also easy to tackle.
So, to install it, just run
sudo apt install mariadb-server
After that, you will have to define a password for the root user which is not created by default.
In this case, we also have the post
How to install MariaDB on Debian 11?
In this post, I show you step by step how to make MariaDB ready for work.
Conclusion
In this post, we have given you a proper introduction to the LAMP stack on Debian 11. This stack is one of the most used by many sysadmins because it is easy to use and above all, it is efficient in the use of computer resources.
So, what did you think about the post? leave us a comment and help us to grow.