If have a SysV style Unix system (such as RedHat, Linux, Mandrake Linux, Solaris, or UnixWare, then you can skip this step and go on to step 9. Otherwise, to prepare the database for startup, you will need to login as the postgres user you added in step 6. Once you are logged in as the postgres user, issue the following commands at the prompt:

su - postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data

The -D option in the above command is the location where the data will be stored. This location is also recognized by the $PGDATA environment variable. If you would like to use a different directory to hold these data files, then make sure the server account can write to that directory.

When the initdb command has completed, initdb will provide you with information on starting the PostgreSQL server. The first command displayed will start the postmaster process in the foreground. That command is:

/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data

The second command displayed will start the postmaster processes in the background. It uses pg_ctl to start the postmaster service:

nohup /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data </dev/null >>server.log
2>&1 >/dev/null &

The major difference between the first command and the second command is that the second runs the postgres process in the background as well as prints the DEBUG information into /dev/null. It prints the DEBUG information to /dev/null by redirecting standard error (stderr) to standard out (stdout) and then redirecting that result to /dev/null. Once the second command is executed, it will display a process id (pid). For normal operation, it is better to run the postmaster process in the background. However there are times when running postmaster in the foreground (debugging) can be useful. pg_ctl.