How to install postgresql on FreeBSD

5,232

You need to run initdb before you can use a postgres server. This can't be done for you as it would destroy your existing database if you were doing an upgrade.

/usr/local/etc/rc.d/postgresql initdb will do what you need if you are using a FreeBSD port, otherwise see the initdb man page.

(Also note that the port's post-install message tells you this - The messages ports print out after you run make install are generally important :)

Share:
5,232

Related videos on Youtube

shabunc
Author by

shabunc

Updated on September 18, 2022

Comments

  • shabunc
    shabunc almost 2 years

    Here is a step-by-step description of what I am doing

    • cd /usr/ports/databases/postgresql91-server/
    • make install clean
    • adding postgresql_enable="YES" to /etc/rc.conf
    • trying to start sudo /usr/local/etc/rc.d/postgresql onsestart.

    After all of these steps, however, I still get the message:

    postgres cannot access the server configuration file "/usr/local/pgsql/data/postgresql.conf": No such file or directory

    What step am I missing?

    • shabunc
      shabunc over 12 years
      @Shads0 - i'm not a seasoned BSD user at all, but as far as I understand this very file (which is missing) should be created by the launcher with respect to the postgresql_enable="YES" in rc.conf
  • shabunc
    shabunc over 12 years
    shame on me, you are right, i should read whatever the terminal says more carefully.
  • voretaq7
    voretaq7 over 12 years
    The first clobbering is free :) (I'm also a little touchy about it because I maintain a few ports - we really do try hard to include all the important stuff in those post-install messages…)