How to install LAMP on Debian 10?

0
247

A new version of Debian has been released. So many people take advantage of this update to do a zero installation on their systems. And one of the basic components of a server is LAMP. Composed of several components that work together, with LAMP you can have a functional web server. At least, for most of the applications or websites, there are. It is also necessary if you are a web developer and need to run your application as you create it. Last but not least, LAMP is used for many educational purposes. So in this post, I will show you how to install LAMP on Debian 10.

Install LAMP on Debian 10

As Debian 10 is a new release, it has a lot of updated software. Besides this, Debian 10 includes in its repositories many different applications and of course, the components of LAMP. So, we will explain each of them.

LAMP – Linux

The first step is to install Debian 10. In this aspect, there are no problems, because we have a post that will help you with that.

How to install Debian 10 Buster?

Then, after you have installed it, we recommend that you upgrade the system to get some recently released security patches.

Apache Web Server

Apache web server is an HTTP server of the Apache Foundation. It is the most popular in the world for its ease of use and configuration, because it has extensive community support and for being installable on many Linux systems.

On the other hand, the Apache web server stands out for its large number of modules that make it perfectly configurable. It is also quite robust and secure.

To install it, open a terminal emulator or connect to your Debian 10 system using SSH. Then, access as the root user and run.

:~$ su
:~# apt install apache2

Once the installation is complete. Debian 10 will automatically start the service and enable it to boot along with the system. However, you can start and stop it manually with these commands:

:~# systemctl start apache2
:~# systemctl stop apache2

If you don’t want me to start the system, use this command:

:~# systemctl disable apache2

But, if you want to enable again:

:~# systemctl enable apache2

After that, open your favorite web browser, and in the address bar access your server. Either by IP address or by domain. You should see the following.

1.- Apache default page on Debian 10
1.- Apache default page on Debian 10

So, Apache is running.

Installing LAMP on Debian 10 – PHP

Until now, the Debian system will only be able to run client-side websites, i.e. front end technology. However, we know that web applications use something else. Mainly, they use a programming language on the server that can run the application.

In the same way, PHP is the most popular web-oriented programming language in the world. Many of the world’s most powerful applications, e.g. WordPress the most widely used CMS, are made in PHP. And so many others. That is why, on a Web server, it has to be PHP.

Open a terminal and run the following command:

:~# apt install php libapache2-mod-php php-mysql php-mbstring php-xml php-zip
2.- Install LAMP on Debian 10 - Install PHP
2.- Install LAMP on Debian 10 – Install PHP

After that, it is a good idea to test PHP. So, create a new file on /var/www/html/ called test.php and add the following. For example, you can use nano.

:~# nano /var/www/html/test.php
<?php
phpinfo();
?>

Then, restart Apache.

:~# systemctl restart apache2

Now, open the file using the web browser. For example, http://your-server/test.php You will see this:

3.- PHP running on Debian 10
3.- PHP running on Debian 10

So, Apache and PHP are running.

Install MariaDB

The last component we need to get to install LAMP on Debian 10 is MariaDB or MySQL. MariaDB is a MySQL fork. It is a great relational SQL database manager with a fairly broad community support.

MariaDB combines usability with security and all under the protection of the community and large distributions such as CentOS, Debian, Ubuntu, and RHEL.

Open a terminal and run this command to install it:

:~# apt install mariadb-server

Then, it is necessary to secure the installation using the mysql_secure_installation script. Using that script, you will be able to define a root password and other basic settings.

:~# mysql_secure_installation

Just, answer the following questions:

Remove anonymous users? Y
Disallow root login remotely? Y
Remove test database and access to it? Y
Reload privilege tables now? Y
4.- Install LAMP on Debian 10 - MariaDB
4.- Install LAMP on Debian 10 – MariaDB
5.- Using mysql_secure_installation script
5.- Using mysql_secure_installation script

And then, you can start to create your databases and new users.

So, you already know how to install LAMP on Debian 10. Enjoy it.

Please share this post with your friends. And join our Telegram Channel.

LEAVE A REPLY

Please enter your comment!
Please enter your name here