title: ubuntu 15.04 install postgresql
body: <p>I followed this article to install postgres
  <a href="https://gorails.com/setup/ubuntu/15.04" rel="nofollow">https://gorails.com/setup/ubuntu/15.04</a></p>
  
  <p>But I m getting this error on trying to start postgresql</p>
  
  <pre><code>vihaan@trojan:~$ sudo -u postgres createuser vihaan -s
  createuser: could not connect to database postgres: 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>Here are the messages from postgres package installation.</p>
  
  <pre><code>vihaan@trojan:~$ sudo apt-get install postgresql-common
  Reading package lists... Done
  Building dependency tree       
  Reading state information... Done
  The following packages were automatically installed and are no longer required:
    dkms libgsoap5 libsdl1.2debian libvncserver0
  Use 'apt-get autoremove' to remove them.
  The following extra packages will be installed:
    postgresql-client-common
  The following NEW packages will be installed:
    postgresql-client-common postgresql-common
  0 upgraded, 2 newly installed, 0 to remove and 97 not upgraded.
  Need to get 0 B/300 kB of archives.
  After this operation, 816 kB of additional disk space will be used.
  Do you want to continue? [Y/n] y
  Preconfiguring packages ...
  Selecting previously unselected package postgresql-client-common.
  (Reading database ... 180173 files and directories currently installed.)
  Preparing to unpack .../postgresql-client-common_169.pgdg12.4+1_all.deb ...
  Unpacking postgresql-client-common (169.pgdg12.4+1) ...
  Selecting previously unselected package postgresql-common.
  Preparing to unpack .../postgresql-common_169.pgdg12.4+1_all.deb ...
  Adding 'diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by postgresql-common'
  Unpacking postgresql-common (169.pgdg12.4+1) ...
  Processing triggers for man-db (2.7.0.2-5) ...
  Processing triggers for systemd (219-7ubuntu6) ...
  Processing triggers for ureadahead (0.100.0-19) ...
  Setting up postgresql-client-common (169.pgdg12.4+1) ...
  Setting up postgresql-common (169.pgdg12.4+1) ...
  
  Creating config file /etc/postgresql-common/createcluster.conf with new version
  
  Creating config file /etc/logrotate.d/postgresql-common with new version
  Building PostgreSQL dictionaries from installed myspell/hunspell packages...
    en_au
    en_gb
    en_us
    en_za
  Removing obsolete dictionary files:
  Processing triggers for systemd (219-7ubuntu6) ...
  Processing triggers for ureadahead (0.100.0-19) ...
  vihaan@trojan:~$ sudo apt-get install postgresql-9.3 libpq-dev
  Reading package lists... Done
  Building dependency tree       
  Reading state information... Done
  libpq-dev is already the newest version.
  The following packages were automatically installed and are no longer required:
    dkms libgsoap5 libsdl1.2debian libvncserver0
  Use 'apt-get autoremove' to remove them.
  Suggested packages:
    oidentd ident-server locales-all postgresql-doc-9.3
  The following NEW packages will be installed:
    postgresql-9.3 postgresql-client-9.3
  0 upgraded, 2 newly installed, 0 to remove and 97 not upgraded.
  Need to get 0 B/4,497 kB of archives.
  After this operation, 21.9 MB of additional disk space will be used.
  Selecting previously unselected package postgresql-client-9.3.
  (Reading database ... 180293 files and directories currently installed.)
  Preparing to unpack .../postgresql-client-9.3_9.3.9-1.pgdg12.4+1_amd64.deb ...
  Unpacking postgresql-client-9.3 (9.3.9-1.pgdg12.4+1) ...
  Selecting previously unselected package postgresql-9.3.
  Preparing to unpack .../postgresql-9.3_9.3.9-1.pgdg12.4+1_amd64.deb ...
  Unpacking postgresql-9.3 (9.3.9-1.pgdg12.4+1) ...
  Processing triggers for postgresql-common (169.pgdg12.4+1) ...
  Building PostgreSQL dictionaries from installed myspell/hunspell packages...
    en_au
    en_gb
    en_us
    en_za
  Removing obsolete dictionary files:
  Setting up postgresql-client-9.3 (9.3.9-1.pgdg12.4+1) ...
  update-alternatives: using /usr/share/postgresql/9.3/man/man1/psql.1.gz to provide /usr/share/man/man1/psql.1.gz (psql.1.gz) in auto mode
  Setting up postgresql-9.3 (9.3.9-1.pgdg12.4+1) ...
  Creating new cluster 9.3/main ...
    config /etc/postgresql/9.3/main
    data   /var/lib/postgresql/9.3/main
    locale en_IN
  Flags of /var/lib/postgresql/9.3/main set as -------------e-C
    port   5432
  update-alternatives: using /usr/share/postgresql/9.3/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode
  vihaan@trojan:~$ sudo -u postgres createuser vihaan -s
  createuser: could not connect to database postgres: 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>