sudo apt install apache2 -y<\/pre>\nOnce installed, start and enable the service.<\/p>\n
sudo systemctl enable apache2 && sudo systemctl start apache2<\/pre>\nCheck if the service is up and running:<\/p>\n
sudo systemctl status apache2<\/pre>\nYou should receive the following output:<\/p>\n
root@host:~# sudo systemctl status apache2\r\n\u25cf apache2.service - The Apache HTTP Server\r\n Loaded: loaded (\/lib\/systemd\/system\/apache2.service; enabled; vendor preset: enabled)\r\n Active: active (running) since Thu 2022-07-21 06:38:48 EDT; 11s ago\r\n Docs: https:\/\/httpd.apache.org\/docs\/2.4\/\r\n Main PID: 1595 (apache2)\r\n Tasks: 55 (limit: 4678)\r\n Memory: 21.2M\r\n CPU: 100ms\r\n CGroup: \/system.slice\/apache2.service\r\n \u251c\u25001595 \/usr\/sbin\/apache2 -k start\r\n \u251c\u25001600 \/usr\/sbin\/apache2 -k start\r\n \u2514\u25001601 \/usr\/sbin\/apache2 -k start\r\n\r\nJul 21 06:38:48 host.test.vps systemd[1]: Starting The Apache HTTP Server...\r\n<\/pre>\n<\/span>Step 3. Install PHP8.1 with dependencies<\/span><\/h2>\nFirst, we need to install some dependencies:<\/p>\n
sudo apt install software-properties-common ca-certificates lsb-release apt-transport-https -y<\/pre>\nNext, we need to add the PHP repository and key since they are not added in Debian 11 repository by default:<\/p>\n
sudo sh -c 'echo \"deb https:\/\/packages.sury.org\/php\/ $(lsb_release -sc) main\" > \/etc\/apt\/sources.list.d\/php.list' \r\n\r\nwget -qO - https:\/\/packages.sury.org\/php\/apt.gpg | sudo apt-key add -<\/pre>\nOnce these are added, update the repository again.<\/p>\n
sudo apt update -y<\/pre>\nTo install the PHP8.1 along with extensions, execute the following command:<\/p>\n
sudo apt-get install php8.1 php8.1-cli php8.1-common php8.1-imap php8.1-redis php8.1-snmp php8.1-xml php8.1-zip php8.1-mbstring php8.1-curl libapache2-mod-php -y\r\n<\/pre>\n<\/span>Step 4. Install MariaDB database server<\/span><\/h2>\nTo install the MariaDB database server, execute the command below.<\/p>\n
sudo apt install mariadb-server -y<\/pre>\nStart and enable the mariadb.service with the following commands:<\/p>\n
sudo systemctl start mariadb && sudo systemctl enable mariadb<\/pre>\nCheck the status of the mariadb.service<\/p>\n
sudo systemctl status mariadb<\/pre>\nYou should receive the following output:<\/p>\n
root@host:~# sudo systemctl status mariadb\r\n\u25cf mariadb.service - MariaDB 10.5.15 database server\r\n Loaded: loaded (\/lib\/systemd\/system\/mariadb.service; enabled; vendor preset: enabled)\r\n Active: active (running) since Thu 2022-07-21 06:46:42 EDT; 13s ago\r\n Docs: man:mariadbd(8)\r\n https:\/\/mariadb.com\/kb\/en\/library\/systemd\/\r\n Main PID: 14557 (mariadbd)\r\n Status: \"Taking your SQL requests now...\"\r\n Tasks: 17 (limit: 4678)\r\n Memory: 66.9M\r\n CPU: 719ms\r\n CGroup: \/system.slice\/mariadb.service\r\n \u2514\u250014557 \/usr\/sbin\/mariadbd\r\n<\/pre>\nTo check the installed MariaDB database version, you can execute the following command:<\/p>\n
mysql -V<\/pre>\nYou should receive the following output:<\/p>\n
root@host:~# mysql -V\r\nmysql Ver 15.1 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper\r\n<\/pre>\n