I recently started using arch. (arch version 5.6.4).
I installed postgresql by running:
sudo pacman -S postgresql
I'm following archwiki guide to initialize the database cluster. I switch to the postgres user by running
sudo -iu postgres
After which, I run:
initdb -D /var/lib/postgres/data
I get the following output:
[postgres@archlinux ~]$ initdb -D /var/lib/postgres/data
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
initdb: error: directory "/var/lib/postgres/data" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/var/lib/postgres/data" or run initdb
with an argument other than "/var/lib/postgres/data".
I figured it wouldn't be wise to remove everything in data, so I made a directory /home/user/postgres/data. After creating this directory, I made postgres its user.
I still get a permissions error when running initdb. I even changed permissions to allow read,write,execute but I can't get past the permission error.
Help?