Follow these steps
1) go to /var/log/postgresql
and open log file
if you see error similar to this in your log file
FATAL: private key file "/etc/ssl/private/ssl-cert-snakeoil.key"
has group or world access
DETAIL: File must have permissions u=rw (0600)
or less if owned by the database user, or permissions u=rw,g=r (0640)
or less if owned by root.
a) execute the following commands to change the permission (make sure to change the key file name if it is diff for you)
$ sudo chown postgres /etc/ssl/private/ssl-cert-snakeoil.key
$ sudo chgrp postgres /etc/ssl/private/ssl-cert-snakeoil.key
$ sudo chmod 740 /etc/ssl/private/ssl-cert-snakeoil.key
now restart the service
$ sudo /etc/init.d/postgresql restart
it should show this messge
[ ok ] Restarting postgresql (via systemctl): postgresql.service.
now type these commands to verify
$ sudo su - postgres
$ psql
You should see this message
root@imp-itpl0023:/etc/ssl/private# su - postgres
postgres@imp-itpl0023:~$ psql
psql (10.3 (Ubuntu 10.3-1.pgdg16.04+1))
Type "help" for help.