{"id":10141,"date":"2021-09-02T20:31:07","date_gmt":"2021-09-02T17:31:07","guid":{"rendered":"https:\/\/kifarunix.com\/?p=10141"},"modified":"2024-03-18T14:13:02","modified_gmt":"2024-03-18T11:13:02","slug":"install-lamp-stack-on-debian-11","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-lamp-stack-on-debian-11\/","title":{"rendered":"Install LAMP Stack on Debian 11"},"content":{"rendered":"\n
Follow through this guide to learn how to install LAMP Stack on Debian 11. If you are looking at building some web application, LAMP stack is the first thing you might need. As you already know, LAMP is a group of opensource web development software; Linux OS, Apache http server<\/a>, MariaDB<\/a>\/MySQL<\/a> relational database management systems and PHP<\/a> web scripting language.<\/p>\n\n\n\n As per the acronym, Linux system is the first component of LAMP stack. And of course Debian 11 is our first component of LAMP stack.<\/p>\n\n\n\n To begin with, update and upgrade your system packages;<\/p>\n\n\n\n Apache web server can be installed by running the command below;<\/p>\n\n\n\n Once the installation is done, Apache is started and enabled to run on system boot.<\/p>\n\n\n\n Verify external access to Apache by navigating to your browser and entering the server IP address or resolvable hostname as To restrict access to Apache, you can install UFW;<\/p>\n\n\n\n Once UFW is installed, you can enable it to secure your system against unrestricted access.<\/p>\n\n\n\n Before you can enable UFW, ensure that you have opened SSH port, in case you had logged in via SSH.<\/p>\n\n\n\n Replace SOURCE_IP<\/strong>, <\/strong> with the address from which you are logging in from.<\/p>\n\n\n\n You can then allow external access to Apache;<\/p>\n\n\n\n or simply run Great. Proceed to install MySQL\/MariaDB on Debian 11.<\/p>\n\n\n\n In this demo, we are running LAMP stack on Debian 11 with MySQL 8.<\/p>\n\n\n\n Therefore, follow the link below to install MySQL 8 on Debian 11;<\/p>\n\n\n\n Install MySQL 8 on Debian 11<\/a><\/p>\n\n\n\n If you want to use MariaDB 10.6, then check the guide below;<\/p>\n\n\n\n Install MariaDB 10.6 on Debian 11<\/a><\/p>\n\n\n\n PHP is the last but not least component in LAMP Stack.<\/p>\n\n\n\n Follow the link below to learn how to install PHP on Debian 11;<\/p>\n\n\n\n Install PHP 7.1\/7.2\/7.3\/7.4 on Debian 11<\/a><\/p>\n\n\n\n If you want to use PHP 8, then check the guide below;<\/p>\n\n\n\n Install PHP 8 on Debian 11<\/a><\/p>\n\n\n\n In this demo, we are going to use PHP 7.4 for our LAMP stack.<\/p>\n\n\n\n Installation of PHP installs with itself other PHP modules such as, Install MySQL module for PHP and any other module you may need for your web application.<\/p>\n\n\n\n You can test PHP to confirm that is working as required as well check the version and installed modules using the simple PHP info script.<\/p>\n\n\n\n Restart Apache<\/p>\n\n\n\n Next, navigate to the browser and enter the address, http:\/\/<server-IP>\/info.php<\/strong><\/p>\n\n\n\n If you see this page, then PHP installation is working pretty well and Apache can server PHP content!<\/p>\n\n\n\n Install LAMP Stack on CentOS 8<\/a><\/p>\n\n\n\n Install LAMP Stack with MariaDB 10 on Debian 10 Buster<\/a><\/p>\n\n\n\nInstalling LAMP Stack on Debian 11<\/h2>\n\n\n\n
Run System Update<\/h3>\n\n\n\n
apt update<\/code><\/pre>\n\n\n\n
apt upgrade<\/code><\/pre>\n\n\n\n
Install Apache Web Server on Debian 11<\/h3>\n\n\n\n
apt install apache2 -y<\/code><\/pre>\n\n\n\n
systemctl status apache2<\/code><\/pre>\n\n\n\n
\u25cf apache2.service - The Apache HTTP Server\n Loaded: loaded (\/lib\/systemd\/system\/apache2.service; enabled; vendor preset: enabled)\n Active: active (running) since Thu 2021-09-02 19:57:45 EAT; 1s ago\n Docs: https:\/\/httpd.apache.org\/docs\/2.4\/\n Process: 2223 ExecStart=\/usr\/sbin\/apachectl start (code=exited, status=0\/SUCCESS)\n Main PID: 2227 (apache2)\n Tasks: 55 (limit: 1133)\n Memory: 8.7M\n CPU: 25ms\n CGroup: \/system.slice\/apache2.service\n \u251c\u25002227 \/usr\/sbin\/apache2 -k start\n \u251c\u25002228 \/usr\/sbin\/apache2 -k start\n \u2514\u25002229 \/usr\/sbin\/apache2 -k start\n\nSep 02 19:57:45 bullseye.kifarunix-demo.com systemd[1]: Starting The Apache HTTP Server...\nSep 02 19:57:45 bullseye.kifarunix-demo.com systemd[1]: Started The Apache HTTP Server.\n<\/code><\/pre>\n\n\n\n
http:\/\/Server.IP_or_hostname<\/code><\/strong>. You should land on Apache HTTP server test page.<\/p>\n\n\n\n
<\/figure><\/a><\/div>\n\n\n\n
apt install ufw<\/code><\/pre>\n\n\n\n
ufw allow from SOURCE_IP<\/strong> to any port 22 proto tcp<\/code><\/pre>\n\n\n\n
ufw allow \"WWW Full\"<\/code><\/pre>\n\n\n\n
ufw allow 80\/tcp<\/code><\/strong> to allow HTTP traffic.<\/p>\n\n\n\n
Install MySQL Database Server on Debian 11<\/h3>\n\n\n\n
Install PHP on Debian 11<\/h3>\n\n\n\n
Installing PHP Modules on Debian 11<\/h4>\n\n\n\n
libapache2-mod-php7.4 libsodium23 php php-common php7.4 php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-readline psmisc<\/code>.<\/p>\n\n\n\n
apt install php-mysql<\/code><\/pre>\n\n\n\n
Testing PHP Processing on Debian 11<\/h4>\n\n\n\n
echo \"<?php phpinfo(); ?>\" > \/var\/www\/html\/info.php<\/code><\/pre>\n\n\n\n
systemctl restart apache2<\/code><\/pre>\n\n\n\n
<\/figure>\n\n\n\n
Related Tutorials<\/h3>\n\n\n\n