PostgreSQL installation

Package installation

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

On OpenSuse 15.2 to install PostgreSQL 12 use:

zypper install postgresql12 postgresql12-server postgresql12-contrib

On Amazon Linux 2 to install PostgreSQL 10 use:

amazon-linux-extras install postgresql10

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 2 instead use:

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

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. On OpenSuse use:

systemctl restart postgresql

On Amazon Linux use:

service postgresql-10 restart

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 .
12.0.0
Installing and configuring PostgreSQL for use with Jiglu.