How To Arrange Apache, MariaDB, PHP (LAMP Stack) on Debian 11

6

LAMP Stack stands for Linux, Apache, MariaDB, and PHP stack. This stack is used by most web website online web hosting companies to host internet websites, blogs and is also used in web characteristics. As a result of free and open-source licensing, this stack is the most efficient option to dear stacks.

Arrange LAMP Stack

Arrange Linux

Practice the Step by the use of Step arrange of Debian 11 or Enhance Debian 10 “Buster” to Debian 11 “Bullseye”.

Now, we will proceed to place in Apache v2.4.48, PHP v7.4, MariaDB v10.5 on Debian 11.

Arrange Apache

First, we will delivery with putting in place the Apache webserver.

sudo apt change

sudo apt arrange -y apache2 apache2-utils

Check out the status of the Apache server supplier put up the arrange.

sudo systemctl status apache2

Output:

 apache2.supplier - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/machine/apache2.supplier; enabled; vendor preset: enabled)
     Energetic: lively (running) since Tue 2021-08-24 09:20:01 CDT; 33s up to now
       Clinical medical doctors: https://httpd.apache.org/medical doctors/2.4/
   Number one PID: 1930 (apache2)
      Tasks: 55 (prohibit: 2321)
     Memory: 10.8M
        CPU: 58ms
     CGroup: /machine.slice/apache2.supplier
             ├─1930 /usr/sbin/apache2 -k delivery
             ├─1932 /usr/sbin/apache2 -k delivery
             └─1933 /usr/sbin/apache2 -k delivery

Aug 24 09:20:01 debian11.holhol24.local systemd[1]: Starting The Apache HTTP Server...
Aug 24 09:20:01 debian11.holhol24.local systemd[1]: Started The Apache HTTP Server.

We will now check out the Apache webserver to check if it is working as we think. So, open up a web browser and then transfer to the following URL.

http://localhost/

OR

http://your-ip-add-ress/

You are going to get the “Apache2 Debian Default Internet web page“. This internet web page confirms that the Apache server is working efficient.

magnificence=”ezlazyload size-full wp-image-537612″ src=”information:;base64,” alt=”Apache Webserver Default Page” width=”823″ height=”647″ data-ezsrc=”https://www.itzgeek.com/wp-content/uploads/2021/08/Apache-Webserver-Default-Page.jpg” data-ez=”” />
Apache Webserver Default Internet web page

Apache HTTP server’s default report root is /var/www/html/ where you will place HTML information, and the primary configuration report is /and plenty of others/apache2/apache2.conf. Additional configuration information are found out inside the /and plenty of others/apache2 list.

Arrange MariaDB

MariaDB is the most popular database server, and it is the drop-in choice of the MySQL server.

Arrange MariaDB server v10.5 from the Debian base repository.

sudo apt arrange -y mariadb-server mariadb-client

Check out the status of the MariaDB database supplier.

sudo systemctl status mariadb

Output:

 mariadb.supplier - MariaDB 10.5.11 database server
     Loaded: loaded (/lib/systemd/machine/mariadb.supplier; enabled; vendor preset: enabled)
     Energetic: lively (running) since Tue 2021-08-24 09:31:02 CDT; 2min 42s up to now
       Clinical medical doctors: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 2951 ExecStartPre=/usr/bin/arrange -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
    Process: 2952 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 2954 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl se>
    Process: 3015 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 3017 ExecStartPost=/and plenty of others/mysql/debian-start (code=exited, status=0/SUCCESS)
   Number one PID: 3001 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 10 (prohibit: 2321)
     Memory: 80.5M
        CPU: 1.027s
     CGroup: /machine.slice/mariadb.supplier
             └─3001 /usr/sbin/mariadbd

Aug 24 09:31:04 debian11.holhol24.local /and plenty of others/mysql/debian-start[3022]: information_schema
Aug 24 09:31:04 debian11.holhol24.local /and plenty of others/mysql/debian-start[3022]: MySQL

Run the mysql_secure_installation command to fortify the safety of your MariaDB database arrange.

sudo mysql_secure_installation

READ: Simple tips on how to Secure MariaDB arrange the use of mysql_secure_installation

Arrange PHP

By the use of default Apache server is helping the .html information best, now not PHP. To have the PHP fortify, we need to arrange PHP and the PHP extension package deal for MariaDB to connect with the database.

sudo apt arrange -y php php-mysql libapache2-mod-php

Restart the Apache server after the arrange of the PHP programs.

sudo systemctl restart apache2

Check out LAMP Stack

To test the LAMP stack, we will place a PHP report on the default report root of the Apache server.

echo "" | sudo tee /var/www/html/information.php

Now, open a web browser and transfer to the following URL.

http://localhost/information.php

OR

http://your-ip-add-ress/information.php

The internet web page will look like underneath,

magnificence=”ezlazyload size-full wp-image-537613″ src=”information:;base64,” alt=”PHP Information” width=”1103″ height=”647″ data-ezsrc=”https://www.itzgeek.com/wp-content/uploads/2021/08/PHP-Information.jpg” data-ez=”” />
PHP Wisdom

You are able to scroll further down to see PHP extension details an identical to MySQL, XML, and PHP variables.

Conclusion

You’ve got successfully put within the LAMP Stack on Debian 11. Additionally, you’ll be able to arrange phpMyAdmin to regulate MariaDB over the web interface.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More