2

I've installed the postgresql-server package on OpenBSD 5.4 amd64, and I try starting it through its rc.d script, however, it doesn't look like it's running after that.

opti# /etc/rc.d/postgresql start
postgresql(ok)
opti# ps auxw | fgrep -i sql
root      8892  0.0  0.0  1652   276 p1  R/1    5:04PM    0:00.00 fgrep -i sql (tcsh)
opti#
  • Why does the script report that it starts successfully?

  • Why does it not actually start?

  • Examine the PostgreSQL server error log files; see if you find anything relevant. Claiming that it has started OK when it hasn't suggests an init script bug really. – Craig Ringer Jan 16 '14 at 23:38
  • I found /var/postgresql/logfile, it says, postgres cannot access the server configuration file "/var/postgresql/data/postgresql.conf": No such file or directory – cnst Jan 17 '14 at 0:28
  • 1
    Did you initdb the database cluster, then? I suggest re-reading the install documentation for PostgreSQL on OpenBSD, wherever that lives on your system. – Craig Ringer Jan 17 '14 at 1:26
  • @cnst Yeah, after you run pkg_add, there should have been some helpful messages pointing you in the right direction. There's at least a few things you need to do after installing the package before you can start postgres up. If for whatever reason that was missing, or you didn't see it, you can check: /usr/local/share/doc/pkg-readmes for the file on postgresql. – gabe. Feb 7 '14 at 18:33
2

Both @CraigRinger (not about the init script, though) and @gabe are right. You should have read the package's README and you need to initdb. From the README:

If you are installing PostgreSQL for the first time, you have to create a default database first. In the following example we install a database in /var/postgresql/data with a dba account 'postgres' and md5 authentication. We will be prompted for a password to protect the dba account:

   # su - _postgresql
   $ mkdir /var/postgresql/data
   $ initdb -D /var/postgresql/data -U postgres -A md5 -W

Please note that by default the cluster's encoding will be SQL_ASCII. If you want to have an another default encoding, use the option -E with initdb:

   $ initdb -D /var/postgresql/data -U postgres -E UTF8 -A md5 -W

README files for all installed packages are in the following directory: /usr/local/share/doc/pkg-readmes.

  • Been helpful on two postgresql installs so far. – Aviator45003 Nov 23 '15 at 21:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.