Apache Web server<\/b>.<\/p>\n\n\n\nsudo apt-get 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; vendor preset: enabled)\n Active: active (running) since Fri 2023-04-21 17:19:44 CDT; 10h ago\n Docs: https:\/\/httpd.apache.org\/docs\/2.4\/\n Main PID: 506 (apache2)\n Tasks: 9 (limit: 4675)\n Memory: 24.5M\n CPU: 2.653s\n CGroup: \/system.slice\/apache2.service\n<\/pre>\n\n\n\nNext, we will install PHP<\/b> along with its extensions. To do that, first add the GPG key and the repo because, in the default repository of Debian 11, they do not exist. To do that, execute the following commands:<\/p>\n\n\n\napt -y install lsb-release apt-transport-https ca-certificates \n\nwget -O \/etc\/apt\/trusted.gpg.d\/php.gpg https:\/\/packages.sury.org\/php\/apt.gpg\n\necho \"deb https:\/\/packages.sury.org\/php\/ $(lsb_release -sc) main\" | tee \/etc\/apt\/sources.list.d\/php.list\n\nsudo apt-get update -y\n<\/pre>\n\n\n\nOnce the PHP key and repo are added, PHP can be installed with the command:<\/p>\n\n\n\n
sudo apt-get install php8.1 php8.1-common php8.1-curl libapache2-mod-php php8.1-imap php8.1-redis php8.1-cli php8.1-snmp php8.1-xml php8.1-zip php8.1-mbstring php8.1-gd php8.1-xml php8.1-mysql php-mbstring php8.1-intl -y<\/pre>\n\n\n\nAfter successful installation, check the PHP version:<\/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\nPHP 8.1.18 (cli) (built: Apr 14 2023 04:39:46) (NTS)\nCopyright (c) The PHP Group\nZend Engine v4.1.18, Copyright (c) Zend Technologies\n with Zend OPcache v8.1.18, Copyright (c), by Zend Technologies\n <\/pre>\n\n\n\nLast is the MariaDB<\/b> database service:<\/p>\n\n\n\nsudo apt-get 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.5.18 database server\n Loaded: loaded (\/lib\/systemd\/system\/mariadb.service; enabled; vendor preset: enabled)\n Active: active (running) since Sat 2023-04-22 04:19:14 CDT; 12s ago\n Docs: man:mariadbd(8)\n https:\/\/mariadb.com\/kb\/en\/library\/systemd\/\n Main PID: 22089 (mariadbd)\n Status: \"Taking your SQL requests now...\"\n Tasks: 18 (limit: 4675)\n Memory: 69.9M\n CPU: 606ms\n CGroup: \/system.slice\/mariadb.service\n \u2514\u250022089 \/usr\/sbin\/mariadbd\n<\/pre>\n\n\n\n