sudo apt install apache2 -y<\/pre>\nOnce installed, start and enable the service.<\/p>\n
sudo systemctl enable apache2.service && sudo systemctl start apache2.service<\/pre>\nCheck if the service is up and running:<\/p>\n
sudo systemctl status apache2.service<\/pre>\nYou should receive the following output:<\/p>\n
root@host:~# sudo systemctl status apache2.service\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 Fri 2022-11-25 14:07:33 CST; 3h 36min ago\r\n Docs: https:\/\/httpd.apache.org\/docs\/2.4\/\r\n Main PID: 746 (apache2)\r\n Tasks: 55 (limit: 4575)\r\n Memory: 9.7M\r\n CPU: 871ms\r\n CGroup: \/system.slice\/apache2.service\r\n \u251c\u2500746 \/usr\/sbin\/apache2 -k start\r\n \u251c\u2500844 \/usr\/sbin\/apache2 -k start\r\n \u2514\u2500845 \/usr\/sbin\/apache2 -k start\r\n\r\nNov 25 14:07:33 host.test.vps systemd[1]: Starting The Apache HTTP Server...\r\nNov 25 14:07:33 host.test.vps systemd[1]: Started The Apache HTTP Server.\r\n<\/pre>\n<\/span>Step 3. Install PHP and extensions<\/span><\/h2>\nPHP8 with extensions and can be installed with the following commands:<\/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 php8.1-mysql -y\r\n<\/pre>\nTo check the installed PHP version, execute the command php -v<\/b><\/p>\nroot@host:~# php -v\r\nPHP 8.1.2-1ubuntu2.9 (cli) (built: Oct 19 2022 14:58:09) (NTS)\r\nCopyright (c) The PHP Group\r\nZend Engine v4.1.2, Copyright (c) Zend Technologies\r\n with Zend OPcache v8.1.2-1ubuntu2.9, Copyright (c), by Zend Technologies\r\n<\/pre>\n<\/span>Step 4. Install PostgreSQL server<\/span><\/h2>\nPostgreSQL version 14 is available in the default repository of Ubuntu 22.04, so we just need to execute the command below:<\/p>\n
sudo apt install postgresql postgresql-client<\/pre>\nOnce installed, start and enable the PostgreSQL service.<\/p>\n
sudo systemctl enable postgresql.service && sudo systemctl start postgresql.service<\/pre>\nCheck if the service is up and running:<\/p>\n
sudo systemctl status postgresql.service<\/pre>\nYou should receive the following output:<\/p>\n
root@host:~# sudo systemctl status postgresql.service\r\n\u25cf postgresql.service - PostgreSQL RDBMS\r\n Loaded: loaded (\/lib\/systemd\/system\/postgresql.service; enabled; vendor preset: enabled)\r\n Active: active (exited) since Fri 2022-11-25 17:38:33 CST; 2min 36s ago\r\n Main PID: 3942 (code=exited, status=0\/SUCCESS)\r\n CPU: 2ms\r\n\r\nNov 25 17:38:33 host.test.vps systemd[1]: Starting PostgreSQL RDBMS...\r\nNov 25 17:38:33 host.test.vps systemd[1]: Finished PostgreSQL RDBMS.<\/pre>\n