Postgresql – How to install postgresql on FreeBSD

freebsdinstallationpostgresql

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?

Best Answer

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 :)