Talk:Postgresql

From SME Server
Jump to navigation Jump to search

Koozali SME v10 and manual install with systemd

  Note:
There is now a contrib for Koozali SME Server v10 - See above for easy installation


This is for reference with PostGresql12 and manual installation:

db yum_repositories set postgresql12 repository \
  BaseURL https://download.postgresql.org/pub/repos/yum/12/redhat/rhel-7Server-\$basearch/ \
  EnableGroups no \
  GPGCheck yes \
  Name "Postgresql-12" \
  GPGKey https://download.postgresql.org/pub/repos/yum/RPM-GPG-KEY-PGDG-12 \
  Visible no \
  status disabled

Update yum

signal-event yum-modify


Install the rpms

yum --enablerepo=postgresql12 install postgresql12-server postgresql12-contrib

Set a config key for SME to recognise the service:

config set postgresql-12 service status enabled access private

We will need a file:

mkdir -p /usr/lib/systemd/system/postgresql-12.service.d
nano /usr/lib/systemd/system/postgresql-12.service.d/50koozali.conf

Add something like this:

[Unit]
After=network.target network.service wan.service
[Install]
WantedBy=sme-server.target

Reconfigure and reboot:

signal-event post-upgrade;signal-event reboot

The service will show as failed at this point.

systemctl status postgresql-12

So we need to init the DB:

/usr/pgsql-12/bin/postgresql-12-setup initdb

Then start it:

systemctl start postgresql-12

And now we can see it running.

We can check some of the defaults:

grep '^blank:*[^[:blank:]#;]' /var/lib/pgsql/12/data/pg_hba.conf
grep '^blank:*[^[:blank:]#;]' /var/lib/pgsql/12/data/postgresql.conf