Create a user for example : postgres
Connect to your system a this user (su - postgres)
root# mkdir /usr/local/pgsql/data root# chown postgres /usr/local/pgsql/data root# su postgres postgres$ initdb -D /usr/local/pgsql/data
Alternatively, you can run initdb via the pg_ctl program like so:
$ pg_ctl -D /usr/local/pgsql/data initdb
Tip: As an alternative to the -D option, you can set the environment variable PGDATA.