Postgresql server doesn't start
<p>[Ubuntu 16.04]
I installed postgresql 9.5 along with dependencies:</p>

<pre><code>sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main' &gt; /etc/apt/sources.list.d/pgdg.list"
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-common
sudo apt-get install postgresql-9.5 libpq-dev
</code></pre>

<p>When I want to run <code>psql</code> then I get:</p>

<pre><code>psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
</code></pre>

<p>But <code>/var/run/postgresql/</code> is empty. When I restart posgresql everything appears to be fine:</p>

<pre><code>$ /etc/init.d/postgresql restart
[ ok ] Restarting postgresql (via systemctl): postgresql.service.

$ /etc/init.d/postgresql status
● postgresql.service - PostgreSQL RDBMS
   Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
   Active: active (exited) since wto 2016-09-27 16:18:26 CEST; 1min 15s ago
  Process: 3076 ExecReload=/bin/true (code=exited, status=0/SUCCESS)
  Process: 3523 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
 Main PID: 3523 (code=exited, status=0/SUCCESS)
</code></pre>

<p>but if check <code>ps aux</code> there is not such PID (why??)</p>

<p>Total reinstalation doesn't help at all. How can I fix it?</p>

<p>Edit:</p>

<p>I've just noticed that then type <code>/etc/init.d/postgresql force-reload</code> postgresql, systemctl are alive awhile and then are killed automatically</p>

<p>Besides systemctl returns</p>

<pre><code>postgresql.service         loaded active exited    PostgreSQL RDBMS
● postgresql@9.5-main.service loaded failed failed    PostgreSQL Cluster 9.5-main 
</code></pre>

<p>Why is it failed?</p>