Stop the postgres service

Create the folder for the new cluster and assing as proprietary to the user and group postgres [/home/postgres/data]

Run as postgres user

$ initdb -D /home/postgres/data

Change several things in /etc/postgresql/9.1/main/postgres.cnf:

  • Allowed conexions
  • Data dir to /home/postgres/data
  • The location of the pg_hba.conf archive

Rename /etc/postgresql/9.1/main/pg_hba.conf to _old

Run as postgres user in the folder /home/postgres/data

$ openssl genrsa -des3 -out server.key 1024

$ openssl rsa -in server.key -out server.key

$ openssl req -new -key server.key -x509 -out server.crt

$ chmod 400 server.*

Start the postgres service