Postgres Fedora 28 Workstation

This is is probably not the best way to fix the problem I am having.

I tend to use postgreSQL when I an faffing with some data. The data I am usually faffing with is huge and on Fedora the problem is that the var directory is in the 50Gb of data provided as part of a separate disk partition used to hold the system files. Don’t know why, but there you go.

So ideally I need to move the data files to somewhere else.

Install postgreSQL from the nice people over at PostgreSQL. Once installed make sure that the postgres user exists.
Create a folder for the user in the “/home/” directory and chown it to the user using:

chown postgres:postgres /home/postgres

…then change the postgres-10.service file using:

sudo su
systemctl edit --full postgresql-10.service

…change the Environment line to use your path as the PGDATA:

Environment=PGDATA=/home/postgres/DATA

then run:

/usr/pgsql-10/bin/postgresql-10-setup initdb

…and make sure that the service is running using:

sudo systemctl enable postgres-10.service
sudo systemctl start postgres-10.service
sudo systemctl status postgres-10.service

Once you have it up and running you can upload files (from somewhere that postgres user can access – like tmp) using:

psql -d police postgres -c "\copy street FROM '/tmp/streetdata.tsv' delimiter E'\t' csv header"