<\/span><\/h2>\n\n\n\nWe will start with the Apache web server from the LAMP stack first. To install the Apache Web server execute the following command:<\/p>\n\n\n\n
sudo apt install apache2 -y<\/pre>\n\n\n\nOnce installed, start and enable the service.<\/p>\n\n\n\n
sudo systemctl enable apache2 && sudo systemctl start apache2<\/pre>\n\n\n\nCheck if the service is up and running:<\/p>\n\n\n\n
sudo systemctl status apache2<\/pre>\n\n\n\nYou should receive the following output:<\/p>\n\n\n\n
root@host:~# sudo systemctl status apache2\n\u25cf apache2.service - The Apache HTTP Server\n Loaded: loaded (\/lib\/systemd\/system\/apache2.service; enabled; preset: enabled)\n Active: active (running) since Thu 2023-08-03 06:02:42 CDT; 22h ago\n Docs: https:\/\/httpd.apache.org\/docs\/2.4\/\n Main PID: 711 (apache2)\n Tasks: 10 (limit: 4644)\n Memory: 29.7M\n CPU: 4.878s\n CGroup: \/system.slice\/apache2.service\n<\/pre>\n\n\n\n<\/span>Step 3. Install PHP8.2 with dependencies<\/span><\/h2>\n\n\n\nNext, we will install PHP. PHP8.2 is by default enabled in the Debian 12 repository, so to install PHP8.2 with extensions, execute the following commands:<\/p>\n\n\n\n
sudo apt-get install php8.2 php8.2-cli php8.2-common php8.2-imap php8.2-redis php8.2-snmp php8.2-xml php8.2-mysqli php8.2-zip php8.2-mbstring php8.2-curl libapache2-mod-php -y\n<\/pre>\n\n\n\nTo check the installed PHP version, execute the following command:<\/p>\n\n\n\n
php -v<\/pre>\n\n\n\nYou should get the following output:<\/p>\n\n\n\n
root@host:~# php -v\nCreated directory: \/var\/lib\/snmp\/cert_indexes\nPHP 8.2.7 (cli) (built: Jun 9 2023 19:37:27) (NTS)\nCopyright (c) The PHP Group\nZend Engine v4.2.7, Copyright (c) Zend Technologies\n with Zend OPcache v8.2.7, Copyright (c), by Zend Technologies\n<\/pre>\n\n\n\n<\/span>Step 4. Install the MariaDB database server<\/span><\/h2>\n\n\n\nThe last of the LAMP stack is the MariaDB database server. To install it, execute the command below.<\/p>\n\n\n\n
sudo apt install mariadb-server -y<\/pre>\n\n\n\nStart and enable the mariadb.service with the following commands:<\/p>\n\n\n\n
sudo systemctl start mariadb && sudo systemctl enable mariadb<\/pre>\n\n\n\nCheck the status of the mariadb.service<\/p>\n\n\n\n
sudo systemctl status mariadb<\/pre>\n\n\n\nYou should receive the following output:<\/p>\n\n\n\n
root@host:~# sudo systemctl status mariadb\n\u25cf mariadb.service - MariaDB 10.11.3 database server\n Loaded: loaded (\/lib\/systemd\/system\/mariadb.service; enabled; preset: enabled)\n Active: active (running) since Fri 2023-08-04 05:04:01 CDT; 26s ago\n Docs: man:mariadbd(8)\n https:\/\/mariadb.com\/kb\/en\/library\/systemd\/\n Main PID: 8511 (mariadbd)\n Status: \"Taking your SQL requests now...\"\n Tasks: 16 (limit: 4644)\n Memory: 174.3M\n CPU: 907ms\n CGroup: \/system.slice\/mariadb.service\n \u2514\u25008511 \/usr\/sbin\/mariadbd\n<\/pre>\n\n\n\n