Command explanations
useradd -d /var/pgsql/data postgres: Add an unprivileged user to run the database server. Running the
server as root is dangerous, and moreover simply will not work.
su - postgres -c '/usr/bin/initdb -D /var/pgsql/data': Initialize the database tablespace. This command may not be executed
by root.
su - postgres -c '/usr/bin/postmaster -D /var/pgsql/data >
/var/pgsql/data/logfile 2>&1 &': Start the database server. User postgres must execute this command as well.
createdb test, create table t1 , insert into t1 values..., select *
from t1: Create a database, add a table to it, insert some rows into the table
and select them to verify that the installation is working
properly.