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

Carsten Rieger

Carsten Rieger is a senior system engineer in full-time and also working as an IT freelancer. He is working with linux environments for more than 13 years, an Open Source enthusiast and highly motivated on linux installation and troubleshooting. Mostly working with Debian/Ubuntu Linux, Nginx and Apache web server, MariaDB/MySQL/PostgreSQL, PHP, Cloud infrastructure (e.g. Nextcloud) and other open source projects (e.g. Roundcube) and in voluntary work for the Dr. Michael & Angela Jacobi Stiftung for more than 6 years.

Leave a Reply

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