PostgreSQL installation

Package installation

First, install the PostgreSQL server packages. Jiglu will work best with PostgreSQL versions 14 or above.

On OpenSuse 15.5 to install PostgreSQL 16 use:

zypper install postgresql16 postgresql16-server postgresql16-contrib

On Amazon Linux 2 to install PostgreSQL 14 use:

amazon-linux-extras install postgresql14

On Fedora or Redhat to install PostgreSQL 15 use:

yum install postgresql15

Shared memory

Most Linux distributions will come with shared memory already suitably configured for running PostgreSQL. You can check this by running:

sysctl -a|grep kernel.shm

Suitable values for most installations are:

kernel.shmall = 1152921504606846720
kernel.shmmax = 18446744073709551615
kernel.shmmni = 4096

If necessary, edit /etc/syctl.conf or add a new configuration file in/etc/sysctl.d with these values and then run sysctl -p to enable them.

Database initialisation

The PostgreSQL database instance needs to be initialised before it is used for the first time and the database started. On OpenSuse this will be done when the service is first started and until then no configuration files will exist.

To create the files on OpenSuse use:

systemctl start postgresql

On Amazon Linux, Fedora or Redhat instead use:

/usr/bin/postgresql-setup initdb
systemctl start postgresql

Set postgres superuser password

It is good practice to set a password for the postgres super user. Most distributions are configured by default to allow access to a PostgreSQL database with the same name as the current user. So, to set this password use:

su postgres
psql
\password
(Enter password twice)
\q

Access control

Jiglu will connect to PostgreSQL over a TCP/IP connection requiring password authentication. You will need to edit pg_hba.conf, normally found in/var/lib/pgsql/data/or a similar directory. Comment out any existing entries and add the following:

local all all password
host all all 127.0.0.1/32 password
host all all ::1/128 password

If the database is running on a separate server from Jiglu then you will need to allow access from that host. You should now restart the database to pick up the access control changes:

systemctl restart postgresql

Configuration

The default PostgreSQL configuration, in postgresql.conf, is generally suitable for most small installations. For more information about tuning the database see PostgreSQL tuning.

Automatic starting

To enable PostgreSQL to start when the server is booted use:

systemctl enable postgresql
Written by Stephen Hebditch. Published on .
14.0.0
Installing and configuring PostgreSQL for use with Jiglu.