title: Remote Connection to PostgreSQL in a Raspberry Pi 2
body: <p>I have a raspberry pi 2 with Debian Jessie OS. I want to connect remotely to postgresql in it.</p>
  
  <p>I installed postgresql with command below:</p>
  
  <pre><code>sudo apt-get install postgresql postgresql-contrib
  </code></pre>
  
  <p>Then I set a password for postgres user:</p>
  
  <pre><code>sudo -u postgres psql postgres
  </code></pre>
  
  <p>Added below line to /etc/postgresql/9.4/main/pg_hba.conf</p>
  
  <pre><code>host  all  all 192.168.1.0/24 md5
  </code></pre>
  
  <p>and below line to /etc/postgresql/9.4/main/postgresql.conf</p>
  
  <pre><code>listen_addresses = '*'
  </code></pre>
  
  <p>Finally I restarted postgresql service:</p>
  
  <pre><code>sudo /etc/init.d/postgresql reload
  sudo /etc/init.d/postgresql restart
  </code></pre>
  
  <p>But when I tried to connect to postgresql server from another pc in 192.168.1.0/24 network I get "server doesn't listen" error from pgadmin.</p>
  
  <p>Also when I use "netstat -an | grep 5432" command, there is nothing.</p>
  
  <p>result of "sudo /etc/init.d/postgresql status" is:</p>
  
  <pre><code>● postgresql.service - PostgreSQL RDBMS
     Loaded: loaded (/lib/systemd/system/postgresql.service; enabled)
     Active: active (exited) since Sat 2016-02-20 15:22:22 UTC; 50min ago
    Process: 21070 ExecReload=/bin/true (code=exited, status=0/SUCCESS)
    Process: 21119 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
   Main PID: 21119 (code=exited, status=0/SUCCESS)
  
  Feb 20 15:22:22 raspberrypi systemd[1]: Starting PostgreSQL RDBMS...
  Feb 20 15:22:22 raspberrypi systemd[1]: Started PostgreSQL RDBMS.
  </code></pre>
  
  <p>So I cant get the problem. Is it about Debian Jessie OS or raspberry pi 2 or another thing? </p>
  
  <p>I have just done same things in an Ubuntu machine and everything is fine.</p>