<\/span><\/h2>\n\n\n\nFirst of the LAMP stack will be the Apache Web server. To install the Apache Web server execute the following command:<\/p>\n\n\n\n
sudo apt install apache2<\/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 Tue 2023-06-17 02:05:30 CDT; 4s ago\n Docs: https:\/\/httpd.apache.org\/docs\/2.4\/\n Process: 39594 ExecStart=\/usr\/sbin\/apachectl start (code=exited, status=0\/SUCCESS)\n Main PID: 39599 (apache2)\n Tasks: 6 (limit: 4571)\n Memory: 9.9M\n CPU: 529ms\n CGroup: \/system.slice\/apache2.service\n<\/pre>\n\n\n\nNext, we will install PHP8.1. To install PHP8.1 with extensions, execute the following commands:<\/p>\n\n\n\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 php8.1-gd php8.1-intl php8.1-mysql -y\n<\/pre>\n\n\n\nTo check the installed PHP version, execute the following command php -v. You should receive the following output:<\/p>\n\n\n\n
root@host:~# php -v\nCreated directory: \/var\/lib\/snmp\/cert_indexes\nPHP 8.1.2-1ubuntu2.11 (cli) (built: Feb 22 2023 22:56:18) (NTS)\nCopyright (c) The PHP Group\nZend Engine v4.1.2, Copyright (c) Zend Technologies\n with Zend OPcache v8.1.2-1ubuntu2.11, Copyright (c), by Zend Technologies\n<\/pre>\n\n\n\nThe last of the LAMP stack is the MariaDB database server. To install the MariaDB database server, 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.6.12 database server\n Loaded: loaded (\/lib\/systemd\/system\/mariadb.service; enabled; vendor preset: enabled)\n Active: active (running) since Tue 2023-06-17 02:25:54 CDT; 11s ago\n Docs: man:mariadbd(8)\n https:\/\/mariadb.com\/kb\/en\/library\/systemd\/\n Process: 43517 ExecStartPre=\/usr\/bin\/install -m 755 -o mysql -g root -d \/var\/run\/mysqld (code=exited, status=0\/SUCCESS)\n Process: 43518 ExecStartPre=\/bin\/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0\/SUCCESS)\n Process: 43520 ExecStartPre=\/bin\/sh -c [ ! -e \/usr\/bin\/galera_recovery ] && VAR= || VAR=`cd \/usr\/bin\/..; \/usr\/bin\/galera_recovery`; [ $? -eq 0 ] && systemctl s>\n Process: 43565 ExecStartPost=\/bin\/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0\/SUCCESS)\n Process: 43567 ExecStartPost=\/etc\/mysql\/debian-start (code=exited, status=0\/SUCCESS)\n Main PID: 43550 (mariadbd)\n Status: \"Taking your SQL requests now...\"\n Tasks: 16 (limit: 4571)\n Memory: 61.2M\n CPU: 801ms\n CGroup: \/system.slice\/mariadb.service\n \u2514\u250043550 \/usr\/sbin\/mariadbd\n<\/pre>\n\n\n\n