Scaricare il Sorgente e scompattarlo  nella directory /usr/src

eseguire i comandi

gmake clean

./configure --with-openssl --disable-float8-byval

 gmake world

gmake install

 

seguire  le istruzioni per la creazione di un certificato SSL self signed  su:

 http://www.postgresql.org/docs/9.1/static/ssl-tcp.html

per brevità :

openssl req -new -text -out server.req
openssl rsa -in privkey.pem -out server.key rm privkey.pem
openssl req -x509 -in server.req -text -key server.key -out server.crt
chmod og-rwx server.key

 attenzione a server.key  va nello stesso path di postgresql.conf  con chmod 600 e chown postgres  

ricompilare  DBI::Pg col SSL usando il CPAN

  export POSTGRES_LIB="/usr/local/pgsql/lib -lssl"

cpan TURNSTEP/DBD-Pg-2.19.3.tar.gz

se fallisce  togliere -lssl

abilitare  l'SSL  nel  progresql.conf

ristartare il servizio

service postgresql-9.1 restart

oppure

service postgresql-9.5 restart