Software Version
Ubuntu 20.04
nginx 1.18
PHP 8.2
PostgreSQL 12
Nextcloud 27.1.4

System update and upgrade

Since we are going to install a lot of things it is recommended to update the package list to get the last version of those packages.

_$: apt update
_$: apt upgrade

Install nginx

_$: apt install nginx

Install PostgreSQL

_$: apt install postgresql

Install PHP

We will install both PHP and the package needed to connect to PostgreSQL databases from your PHP code. If you are going to connect to another database you will have to change that package accordingly (e.g. php7.0-mysql for MySQL).

_$: apt install php8.2 php8.2-fpm php8.2-json
_$: apt install php8.2-pgsql

The php8.2 package will install the following packages:

  • php-common
  • php8.2-cli
  • php8.2-common
  • php8.2-opcache
  • php8.2-readline

but we will need some more PHP packages for nextcloud to run:

_$: apt install php8.2-curl php8.2-gd php8.2-intl php8.2-mbstring php8.2-xml php8.2-zip

And depending on the nextcloud functionality, you will need to install some more:

_$: apt install php8.2-bcmath php8.2-gmp php8.2-imagick