PostgreSQL installation

Package installation

First, install the PostgreSQL server packages. Jiglu will work with PostgreSQL versions 9.2 to 10.5.

On OpenSuse use:

zypper install postgresql96 postgresql96-server postgresql96-contrib postgresql-init

On Amazon Linux instead use:

yum install postgresql96 postgresql96-libs postgresql96-server

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

systemctl start postgresql

On Amazon Linux instead use:

service postgresql96 initdb
service postgresql96 start

Set postgres superuser password

It is good practice to set a password for thepostgres 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 postgresql96 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, on OpenSuse use:

systemctl enable postgresql

On Amazon Linux instead use:

chkconfig postgresql96 on
Written by Stephen Hebditch. Published on .
10.0.0
Installing and configuring PostgreSQL for use with Jiglu.