Postgresql 10 instead of MariaDB/MySQL



Pre-Requirements:

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main"

Install Postgresql:

apt update && apt install postgresql-10 php7.2-pgsql -y

Create the databse, databse user and grant permissions:

sudo -u postgres psql <<END
CREATE USER nextcloud WITH PASSWORD 'nextcloud';
CREATE DATABASE nextcloud WITH OWNER nextcloud TEMPLATE template0 ENCODING 'UTF8';
END

Restart the relevant services:

service postgresql restart && service php7.2-fpm restart

Tune Postgresql using

https://pgtune.leopard.in.ua/#/

You don’t know the amount of CPUs and RAM?:

cat /proc/cpuinfo | grep processor | wc -l
grep MemTotal /proc/meminfo

or issue

sudo htop

and ammend your

vi /etc/postgresql/10/main/postgresql.conf

with the calculated values. Then restart Postgresql

service postgresql restart

Enjoy your personal data in your secured and hardened Nextcloud-Server!

Don’t forget to backup your Nextcloud

Find more instructions here: Nextcloud Backup and Restore



Carsten Rieger

Leave a Reply

Your email address will not be published. Required fields are marked *