la procédure que j'avais posté est à revoir
je ne là supprime pas car elle fonctionne postgresql <11
Installation
sudo pacman -S postgresql postgresql-docs
sudo pacman -S pgadmin4
******
installation dans un répertoire distinct de la racine système
pensez si crash
sudo mkdir /home/pgsql
sudo mkdir /home/pgsql/data
autorisation
sudo chown -R postgres:postgres /home/pgsql
sudo systemctl stop postgresql
modifier les variables pour dire ou se trouve la data-base
et donnez l'autorisation pour HOME sinon vous aurez une interdiction (permission) voir plus s'il y a lieu
sudo mousepad /usr/lib/systemd/system/postgresql.service
#Environment=PGROOT=/var/lib/postgres
Environment=PGROOT=/home/pgsql
# PIDFile=/var/lib/postgres/data/postmaster.pid
PIDFile=/home/pgsql/data/postmaster.pid
#ProtectHome=true
ProtectHome=false
sudo -i -u postgres
initdb --locale fr_FR.UTF-8 -D '/home/pgsql/data'
ctrl + d
on réinitialise le daemon
sudo systemctl daemon-reload
sudo systemctl start postgresql
systemctl status postgresql.service
sudo -i -u postgres
psql
\password postgres
ctrl + d
---------- démarrage automatique
systemctl enable postgresql
systemctl disable postgresql